UML - Make hostfs_setattr() support operations on unlinked open files.
PATCH 1/3 UML - Make hostfs_setattr() support operations on unlinked open files.
From: Alberto Bertogli <[email protected]>
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.
--
fs/hostfs/hostfs.h | 4 - fs/hostfs/hostfs_kern.c | 6 +- fs/hostfs/hostfs_user.c | 106 ++++++++++++++++++++++++++++++------------------ 3 files changed, 73 insertions(+), 43 deletions(-)
fs/hostfs/hostfs.h +2 -2
@@ -55,7 +55,7 @@ extern int stat_file(const char *path, u int *mode_out, int *nlink_out, int *uid_out, int *gid_out, unsigned long long *size_out, struct timespec *atime_out, struct timespec *mtime_out, struct timespec *ctime_out, - int *blksize_out, unsigned long long *blocks_out); + int *blksize_out, unsigned long long *blocks_out, int fd);extern int access_file (char *path,int r,int w,int x);extern int open_file (char *path,int r,int w,int append);extern int file_type (const char *path,int *maj,int *min);
@@ -71,7 +71,7 @@ extern int lseek_file(int fd, long longextern int fsync_file (int fd,int datasync);extern int file_create (char *name,int ur,int uw,int ux,int gr,int gw,int gx,int or,int ow,int ox); -extern int set_attr (const char *file,struct hostfs_iattr *attrs); +extern int set_attr (const char *file,struct hostfs_iattr *attrs,int fd);extern int make_symlink (const char *from,const char *to);extern int unlink_file (const char *file);extern int do_mkdir (const char *file,int mode);
fs/hostfs/hostfs_kern.c +4 -2
@@ -147,7 +147,7 @@ static int read_name(struct inode *ino, 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 *dentrychar *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 } 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);
fs/hostfs/hostfs_user.c +67 -39
137 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel