source:
trunk/server/common/patches/openafs-d_splice_alias-reference.patch
@
2658
Last change on this file since 2658 was 2655, checked in by andersk, 10 years ago | |
---|---|
File size: 2.1 KB |
-
src/afs/LINUX/osi_vnodeops.c
From 1c576fdf9f05c6af7b5b029ba010a76bed48488e Mon Sep 17 00:00:00 2001 From: Marc Dionne <marc.dionne@your-file-system.com> Date: Thu, 18 Dec 2014 08:43:22 -0500 Subject: [PATCH] Linux: d_splice_alias may drop inode reference on error d_splice_alias now drops the inode reference on error, so we need to grab an extra one to make sure that the inode doesn't go away, and release it when done if there was no error. For kernels that may not drop the reference, provide an additional iput() within an ifdef. This could be hooked up to a configure option to allow building a module for a kernel that is known not to drop the reference on error. That hook is not provided here. Affected kernels should be the early 3.17 ones (3.17 - 3.17.2); 3.16 and older kernels should not return errors here. Change-Id: Id1786ac2227b4d8e0ae801fe59c15a0ecd975bed --- src/afs/LINUX/osi_vnodeops.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index b2ab9d5..3723cf8 100644
a b afs_linux_lookup(struct inode *dip, struct dentry *dp) 1612 1612 ip->i_flags |= S_AUTOMOUNT; 1613 1613 #endif 1614 1614 } 1615 /* 1616 * Take an extra reference so the inode doesn't go away if 1617 * d_splice_alias drops our reference on error. 1618 */ 1619 if (ip) 1620 igrab(ip); 1621 1615 1622 newdp = d_splice_alias(ip, dp); 1616 1623 1617 1624 done: … … afs_linux_lookup(struct inode *dip, struct dentry *dp) 1625 1632 * d_splice_alias can return an error (EIO) if there is an existing 1626 1633 * connected directory alias for this dentry. 1627 1634 */ 1628 if (!IS_ERR(newdp)) 1635 if (!IS_ERR(newdp)) { 1636 iput(ip); 1629 1637 return newdp; 1630 else {1638 } else { 1631 1639 d_add(dp, ip); 1640 /* 1641 * Depending on the kernel version, d_splice_alias may or may 1642 * not drop the inode reference on error. If it didn't, do it 1643 * here. 1644 */ 1645 #if defined(D_SPLICE_ALIAS_LEAK_ON_ERROR) 1646 iput(ip); 1647 #endif 1632 1648 return NULL; 1633 1649 } 1634 } else 1650 } else { 1651 if (ip) 1652 iput(ip); 1635 1653 return ERR_PTR(afs_convert_code(code)); 1654 } 1636 1655 } 1637 1656 1638 1657 static int
Note: See TracBrowser
for help on using the repository browser.