Unionfs: find lower inode of unlinked opened files in setattr
authorErez Zadok <ezk@cs.sunysb.edu>
Sat, 30 Apr 2011 05:33:55 +0000 (01:33 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 12 Aug 2011 02:39:29 +0000 (22:39 -0400)
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 00662387d45d23cd8e47f1b80630d707a82135ee..0a27fab5e9f350945fc036bfaf39da0d9033372f 100644 (file)
@@ -936,7 +936,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);