Skip to content

Commit e67f021

Browse files
rhvgoyalMiklos Szeredi
authored andcommitted
ovl: clear ATTR_FILE from attr->ia_valid
ovl_setattr() can be passed an attr which has ATTR_FILE set and attr->ia_file is a file pointer to overlay file. This is done in open(O_TRUNC) path. We should either replace with attr->ia_file with underlying file object or clear ATTR_FILE so that underlying filesystem does not end up using overlayfs file object pointer. There are no good use cases yet so for now clear ATTR_FILE. fuse seems to be one user which can use this. But it can work even without this. So it is not mandatory to pass ATTR_FILE to fuse. Signed-off-by: Vivek Goyal <[email protected]> Fixes: bccece1 ("ovl: allow remote upper") Signed-off-by: Miklos Szeredi <[email protected]>
1 parent ae83d0b commit e67f021

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/overlayfs/inode.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr)
5858
if (attr->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
5959
attr->ia_valid &= ~ATTR_MODE;
6060

61+
/*
62+
* We might have to translate ovl file into underlying file
63+
* object once some use cases are there. For now, simply don't
64+
* let underlying filesystem rely on attr->ia_file
65+
*/
66+
attr->ia_valid &= ~ATTR_FILE;
67+
6168
inode_lock(upperdentry->d_inode);
6269
old_cred = ovl_override_creds(dentry->d_sb);
6370
err = notify_change(upperdentry, attr, NULL);

0 commit comments

Comments
 (0)