aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hostfs/hostfs_kern.c
diff options
context:
space:
mode:
authorAlberto Bertogli <albertito@gmail.com>2007-05-08 03:23:16 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:14:57 -0400
commit5822b7faca709c03a59c2929005bfe9caffe6592 (patch)
tree4de7b322cfd25794a79cb46b0feab1113785f7a8 /fs/hostfs/hostfs_kern.c
parent0e6b9c98be1b517bf99a21d8a7036a8a21e47dd1 (diff)
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 <albertito@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hostfs/hostfs_kern.c')
-rw-r--r--fs/hostfs/hostfs_kern.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index fd301a910122..4e8bb2fba048 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)
147 147
148 err = stat_file(name, &i_ino, &i_mode, &i_nlink, &ino->i_uid, 148 err = stat_file(name, &i_ino, &i_mode, &i_nlink, &ino->i_uid,
149 &ino->i_gid, &i_size, &ino->i_atime, &ino->i_mtime, 149 &ino->i_gid, &i_size, &ino->i_atime, &ino->i_mtime,
150 &ino->i_ctime, &i_blksize, &i_blocks); 150 &ino->i_ctime, &i_blksize, &i_blocks, -1);
151 if(err) 151 if(err)
152 return(err); 152 return(err);
153 153
@@ -820,6 +820,8 @@ int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
820 char *name; 820 char *name;
821 int err; 821 int err;
822 822
823 int fd = HOSTFS_I(dentry->d_inode)->fd;
824
823 err = inode_change_ok(dentry->d_inode, attr); 825 err = inode_change_ok(dentry->d_inode, attr);
824 if (err) 826 if (err)
825 return err; 827 return err;
@@ -864,7 +866,7 @@ int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
864 } 866 }
865 name = dentry_name(dentry, 0); 867 name = dentry_name(dentry, 0);
866 if(name == NULL) return(-ENOMEM); 868 if(name == NULL) return(-ENOMEM);
867 err = set_attr(name, &attrs); 869 err = set_attr(name, &attrs, fd);
868 kfree(name); 870 kfree(name);
869 if(err) 871 if(err)
870 return(err); 872 return(err);