From 5822b7faca709c03a59c2929005bfe9caffe6592 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Tue, 8 May 2007 00:23:16 -0700 Subject: uml: make hostfs_setattr() support operations on unlinked open files This patch allows hostfs_setattr() to work on unlinked open files by calling set_attr() (the userspace part) with the inode's fd. Without this, applications that depend on doing attribute changes to unlinked open files will fail. It works by using the fd versions instead of the path ones (for example fchmod() instead of chmod(), fchown() instead of chown()) when an fd is available. Signed-off-by: Alberto Bertogli Signed-off-by: Jeff Dike Cc: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/hostfs/hostfs_kern.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fs/hostfs/hostfs_kern.c') diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index fd301a91012..4e8bb2fba04 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -147,7 +147,7 @@ static int read_name(struct inode *ino, char *name) err = stat_file(name, &i_ino, &i_mode, &i_nlink, &ino->i_uid, &ino->i_gid, &i_size, &ino->i_atime, &ino->i_mtime, - &ino->i_ctime, &i_blksize, &i_blocks); + &ino->i_ctime, &i_blksize, &i_blocks, -1); if(err) return(err); @@ -820,6 +820,8 @@ int hostfs_setattr(struct dentry *dentry, struct iattr *attr) char *name; int err; + int fd = HOSTFS_I(dentry->d_inode)->fd; + err = inode_change_ok(dentry->d_inode, attr); if (err) return err; @@ -864,7 +866,7 @@ int hostfs_setattr(struct dentry *dentry, struct iattr *attr) } name = dentry_name(dentry, 0); if(name == NULL) return(-ENOMEM); - err = set_attr(name, &attrs); + err = set_attr(name, &attrs, fd); kfree(name); if(err) return(err); -- cgit v1.2.3