Unionfs: find lower inode of unlinked opened files in setattr
authorErez Zadok <ezk@cs.sunysb.edu>
Tue, 6 Sep 2011 04:10:41 +0000 (00:10 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 31 Jan 2012 05:06:23 +0000 (00:06 -0500)
To find the inode of a lower file that's open but unlinked, we cannot find
it via unionfs_lower_inode as that's NULL; but we can get it properly from
lower_dentry->d_inode.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/inode.c

index d04f3a225d44cf7b969a0b9bf6ae37da77f7514b..04c64bec675a5dab7ff07b0ab8381667264e11d2 100644 (file)
@@ -927,7 +927,12 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)
                err = -EINVAL;
                goto out;
        }
-       lower_inode = unionfs_lower_inode(inode);
+
+       /*
+        * Get the lower inode directly from lower dentry, in case ibstart
+        * is -1 (which happens when the file is open but unlinked.
+        */
+       lower_inode = lower_dentry->d_inode;
 
        /* check if user has permission to change lower inode */
        err = inode_change_ok(lower_inode, ia);