From fb5c6ef373d30e882fa708d89d4fe0373de152f1 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Mon, 5 Sep 2011 21:20:36 -0400 Subject: [PATCH] Unionfs: find lower inode of unlinked opened files in setattr 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 --- fs/unionfs/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c index a0af9b4afc6..be7855815c5 100644 --- a/fs/unionfs/inode.c +++ b/fs/unionfs/inode.c @@ -929,7 +929,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); -- 2.43.0