--- linux-2.6.13-vs2.0.1/fs/open.c 2005-08-29 22:42:13 +0200 +++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/open.c 2005-09-14 03:45:31 +0200 @@ -667,7 +668,8 @@ out: return error; } -static int chown_common(struct dentry * dentry, uid_t user, gid_t group) +static int chown_common(struct dentry *dentry, struct vfsmount *mnt, + uid_t user, gid_t group) { struct inode * inode; int error; --- linux-2.6.13-vs2.0.1/fs/open.c 2005-08-29 22:42:13 +0200 +++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/open.c 2005-09-14 03:45:31 +0200 @@ -679,7 +681,7 @@ static int chown_common(struct dentry * goto out; } error = -EROFS; - if (IS_RDONLY(inode)) + if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) goto out; error = -EPERM; if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) --- linux-2.6.13-vs2.0.1/fs/open.c 2005-08-29 22:42:13 +0200 +++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/open.c 2005-09-14 03:45:31 +0200 @@ -709,7 +711,7 @@ asmlinkage long sys_chown(const char __u error = user_path_walk(filename, &nd); if (!error) { - error = chown_common(nd.dentry, user, group); + error = chown_common(nd.dentry, nd.mnt, user, group); path_release(&nd); } return error; --- linux-2.6.13-vs2.0.1/fs/open.c 2005-08-29 22:42:13 +0200 +++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/open.c 2005-09-14 03:45:31 +0200 @@ -722,7 +724,7 @@ asmlinkage long sys_lchown(const char __ error = user_path_walk_link(filename, &nd); if (!error) { - error = chown_common(nd.dentry, user, group); + error = chown_common(nd.dentry, nd.mnt, user, group); path_release(&nd); } return error; --- linux-2.6.13-vs2.0.1/fs/open.c 2005-08-29 22:42:13 +0200 +++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/open.c 2005-09-14 03:45:31 +0200 @@ -736,7 +738,7 @@ asmlinkage long sys_fchown(unsigned int file = fget(fd); if (file) { - error = chown_common(file->f_dentry, user, group); + error = chown_common(file->f_dentry, file->f_vfsmnt, user, group); fput(file); } return error; --- linux-2.6.13-vs2.0.1/fs/open.c 2005-08-29 22:42:13 +0200 +++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/open.c 2005-09-14 03:45:31 +0200 @@ -765,7 +767,7 @@ struct file *filp_open(const char * file if ((namei_flags+1) & O_ACCMODE) namei_flags++; if (namei_flags & O_TRUNC) - namei_flags |= 2; + namei_flags |= FMODE_WRITE; error = open_namei(filename, namei_flags, mode, &nd); if (!error)