SOURCES: linux-2.6-vs2-BME.patch (NEW) - vserver bind mount extens...

baggins baggins at pld-linux.org
Tue Aug 23 15:34:03 CEST 2005


Author: baggins                      Date: Tue Aug 23 13:34:03 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- vserver bind mount extensions

---- Files affected:
SOURCES:
   linux-2.6-vs2-BME.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/linux-2.6-vs2-BME.patch
diff -u /dev/null SOURCES/linux-2.6-vs2-BME.patch:1.1
--- /dev/null	Tue Aug 23 15:34:03 2005
+++ SOURCES/linux-2.6-vs2-BME.patch	Tue Aug 23 15:33:58 2005
@@ -0,0 +1,911 @@
+;
+; http://vserver.13thfloor.at/Experimental/BME/delta-2.6.11.5-vs1.9.5.3-bme0.06.1.diff
+;
+; Bind Mount Extensions 
+;
+; this patch adds some functionality to the --bind
+; type of vfs mounts.
+;
+; (C) 2003-2004 Herbert Pötzl <herbert at 13thfloor.at>
+;
+; Changelog:  
+;
+;   0.01  - readonly bind mounts
+;   0.02  - added ro truncate handling
+;         - added ro (f)chown, (f)chmod handling
+;   0.03  - added ro utime(s) handling
+;         - added ro access and *_ioctl
+;   0.04  - added noatime and nodiratime
+;         - made autofs4 update_atime uncond
+;   0.05  - rewrite regarding (a)time
+;         - adapted to new 2.6 vfs
+;   0.05.1  check for *->mnt added
+;
+; this patch is free software; you can redistribute it and/or
+; modify it under the terms of the GNU General Public License
+; as published by the Free Software Foundation; either version 2
+; of the License, or (at your option) any later version.
+; 
+; this patch is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+; GNU General Public License for more details.
+
+diff -NurpP --minimal linux-2.6.11.5-vs1.9.5.3/arch/sparc64/solaris/fs.c linux-2.6.11.5-vs1.9.5.3-bme0.06.1/arch/sparc64/solaris/fs.c
+--- linux-2.6.11.5-vs1.9.5.3/arch/sparc64/solaris/fs.c	2004-12-25 01:54:50 +0100
++++ linux-2.6.11.5-vs1.9.5.3-bme0.06.1/arch/sparc64/solaris/fs.c	2005-03-26 00:25:23 +0100
+@@ -362,7 +362,7 @@ static int report_statvfs(struct vfsmoun
+ 		int j = strlen (p);
+ 		
+ 		if (j > 15) j = 15;
+-		if (IS_RDONLY(inode)) i = 1;
++		if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
+ 		if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
+ 		if (!sysv_valid_dev(inode->i_sb->s_dev))
+ 			return -EOVERFLOW;
+@@ -398,7 +398,7 @@ static int report_statvfs64(struct vfsmo
+ 		int j = strlen (p);
+ 		
+ 		if (j > 15) j = 15;
+-		if (IS_RDONLY(inode)) i = 1;
++		if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt)) i = 1;
+ 		if (mnt->mnt_flags & MNT_NOSUID) i |= 2;
+ 		if (!sysv_valid_dev(inode->i_sb->s_dev))
+ 			return -EOVERFLOW;
+diff -NurpP --minimal linux-2.6.11.5-vs1.9.5.3/fs/ext2/ioctl.c linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/ext2/ioctl.c
+--- linux-2.6.11.5-vs1.9.5.3/fs/ext2/ioctl.c	2005-03-23 21:34:31 +0100
++++ linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/ext2/ioctl.c	2005-03-26 00:25:23 +0100
+@@ -29,7 +29,8 @@ int ext2_ioctl (struct inode * inode, st
+ 	case EXT2_IOC_SETFLAGS: {
+ 		unsigned int oldflags;
+ 
+-		if (IS_RDONLY(inode))
++		if (IS_RDONLY(inode) ||
++			(filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
+ 			return -EROFS;
+ 
+ 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
+@@ -70,7 +71,8 @@ int ext2_ioctl (struct inode * inode, st
+ 	case EXT2_IOC_SETVERSION:
+ 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
+ 			return -EPERM;
+-		if (IS_RDONLY(inode))
++		if (IS_RDONLY(inode) ||
++			(filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
+ 			return -EROFS;
+ 		if (get_user(inode->i_generation, (int __user *) arg))
+ 			return -EFAULT;	
+diff -NurpP --minimal linux-2.6.11.5-vs1.9.5.3/fs/ext3/ioctl.c linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/ext3/ioctl.c
+--- linux-2.6.11.5-vs1.9.5.3/fs/ext3/ioctl.c	2005-03-23 21:34:33 +0100
++++ linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/ext3/ioctl.c	2005-03-26 00:25:23 +0100
+@@ -36,7 +36,8 @@ int ext3_ioctl (struct inode * inode, st
+ 		unsigned int oldflags;
+ 		unsigned int jflag;
+ 
+-		if (IS_RDONLY(inode))
++		if (IS_RDONLY(inode) ||
++			(filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
+ 			return -EROFS;
+ 
+ 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
+@@ -114,7 +115,8 @@ flags_err:
+ 
+ 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
+ 			return -EPERM;
+-		if (IS_RDONLY(inode))
++		if (IS_RDONLY(inode) ||
++			(filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
+ 			return -EROFS;
+ 		if (get_user(generation, (int __user *) arg))
+ 			return -EFAULT;
+@@ -165,7 +167,8 @@ flags_err:
+ 		if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
+ 			return -ENOTTY;
+ 
+-		if (IS_RDONLY(inode))
++		if (IS_RDONLY(inode) ||
++			(filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
+ 			return -EROFS;
+ 
+ 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
+@@ -186,7 +189,8 @@ flags_err:
+ 		if (!capable(CAP_SYS_RESOURCE))
+ 			return -EPERM;
+ 
+-		if (IS_RDONLY(inode))
++		if (IS_RDONLY(inode) ||
++			(filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
+ 			return -EROFS;
+ 
+ 		if (get_user(n_blocks_count, (__u32 __user *)arg))
+@@ -207,7 +211,8 @@ flags_err:
+ 		if (!capable(CAP_SYS_RESOURCE))
+ 			return -EPERM;
+ 
+-		if (IS_RDONLY(inode))
++		if (IS_RDONLY(inode) ||
++			(filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
+ 			return -EROFS;
+ 
+ 		if (copy_from_user(&input, (struct ext3_new_group_input __user *)arg,
+diff -NurpP --minimal linux-2.6.11.5-vs1.9.5.3/fs/hfsplus/ioctl.c linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/hfsplus/ioctl.c
+--- linux-2.6.11.5-vs1.9.5.3/fs/hfsplus/ioctl.c	2005-03-02 12:38:44 +0100
++++ linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/hfsplus/ioctl.c	2005-03-26 00:25:23 +0100
+@@ -34,7 +34,8 @@ int hfsplus_ioctl(struct inode *inode, s
+ 			flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */
+ 		return put_user(flags, (int __user *)arg);
+ 	case HFSPLUS_IOC_EXT2_SETFLAGS: {
+-		if (IS_RDONLY(inode))
++		if (IS_RDONLY(inode) ||
++			(filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
+ 			return -EROFS;
+ 
+ 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
+diff -NurpP --minimal linux-2.6.11.5-vs1.9.5.3/fs/namei.c linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/namei.c
+--- linux-2.6.11.5-vs1.9.5.3/fs/namei.c	2005-03-25 23:52:18 +0100
++++ linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/namei.c	2005-03-26 00:25:23 +0100
+@@ -242,7 +242,7 @@ int permission(struct inode *inode, int 
+ 		/*
+ 		 * Nobody gets write access to a read-only fs.
+ 		 */
+-		if (IS_RDONLY(inode) &&
++		if ((IS_RDONLY(inode) || (nd && MNT_IS_RDONLY(nd->mnt))) &&
+ 		    (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
+ 			return -EROFS;
+ 
+@@ -1162,7 +1162,8 @@ static inline int check_sticky(struct in
+  * 10. We don't allow removal of NFS sillyrenamed files; it's handled by
+  *     nfs_async_unlink().
+  */
+-static inline int may_delete(struct inode *dir,struct dentry *victim,int isdir)
++static inline int may_delete(struct inode *dir, struct dentry *victim,
++	int isdir, struct nameidata *nd)
+ {
+ 	int error;
+ 
+@@ -1171,7 +1172,7 @@ static inline int may_delete(struct inod
+ 
+ 	BUG_ON(victim->d_parent->d_inode != dir);
+ 
+-	error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
++	error = permission(dir,MAY_WRITE | MAY_EXEC, nd);
+ 	if (error)
+ 		return error;
+ 	if (IS_APPEND(dir))
+@@ -1332,7 +1333,8 @@ int may_open(struct nameidata *nd, int a
+ 			return -EACCES;
+ 
+ 		flag &= ~O_TRUNC;
+-	} else if (IS_RDONLY(inode) && (flag & FMODE_WRITE))
++	} else if ((IS_RDONLY(inode) || MNT_IS_RDONLY(nd->mnt))
++		&& (flag & FMODE_WRITE))
+ 		return -EROFS;
+ 	/*
+ 	 * An append-only file must be opened in append mode for writing.
+@@ -1580,9 +1582,10 @@ fail:
+ }
+ EXPORT_SYMBOL_GPL(lookup_create);
+ 
+-int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
++int vfs_mknod(struct inode *dir, struct dentry *dentry,
++	int mode, dev_t dev, struct nameidata *nd)
+ {
+-	int error = may_create(dir, dentry, NULL);
++	int error = may_create(dir, dentry, nd);
+ 
+ 	if (error)
+ 		return error;
+@@ -1624,7 +1627,6 @@ asmlinkage long sys_mknod(const char __u
+ 		goto out;
+ 	dentry = lookup_create(&nd, 0);
+ 	error = PTR_ERR(dentry);
+-
+ 	if (!IS_POSIXACL(nd.dentry->d_inode))
+ 		mode &= ~current->fs->umask;
+ 	if (!IS_ERR(dentry)) {
+@@ -1633,11 +1635,12 @@ asmlinkage long sys_mknod(const char __u
+ 			error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);
+ 			break;
+ 		case S_IFCHR: case S_IFBLK:
+-			error = vfs_mknod(nd.dentry->d_inode,dentry,mode,
+-					new_decode_dev(dev));
++			error = vfs_mknod(nd.dentry->d_inode, dentry, mode,
++					new_decode_dev(dev), &nd);
+ 			break;
+ 		case S_IFIFO: case S_IFSOCK:
+-			error = vfs_mknod(nd.dentry->d_inode,dentry,mode,0);
++			error = vfs_mknod(nd.dentry->d_inode, dentry, mode,
++					0, &nd);
+ 			break;
+ 		case S_IFDIR:
+ 			error = -EPERM;
+@@ -1655,9 +1658,10 @@ out:
+ 	return error;
+ }
+ 
+-int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
++int vfs_mkdir(struct inode *dir, struct dentry *dentry,
++	int mode, struct nameidata *nd)
+ {
+-	int error = may_create(dir, dentry, NULL);
++	int error = may_create(dir, dentry, nd);
+ 
+ 	if (error)
+ 		return error;
+@@ -1698,7 +1702,8 @@ asmlinkage long sys_mkdir(const char __u
+ 		if (!IS_ERR(dentry)) {
+ 			if (!IS_POSIXACL(nd.dentry->d_inode))
+ 				mode &= ~current->fs->umask;
+-			error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
++			error = vfs_mkdir(nd.dentry->d_inode, dentry,
++				mode, &nd);
+ 			dput(dentry);
+ 		}
+ 		up(&nd.dentry->d_inode->i_sem);
+@@ -1742,9 +1747,10 @@ void dentry_unhash(struct dentry *dentry
+ 	spin_unlock(&dcache_lock);
+ }
+ 
+-int vfs_rmdir(struct inode *dir, struct dentry *dentry)
++int vfs_rmdir(struct inode *dir, struct dentry *dentry,
++	struct nameidata *nd)
+ {
+-	int error = may_delete(dir, dentry, 1);
++	int error = may_delete(dir, dentry, 1, nd);
+ 
+ 	if (error)
+ 		return error;
+@@ -1806,7 +1812,7 @@ asmlinkage long sys_rmdir(const char __u
+ 	dentry = lookup_hash(&nd.last, nd.dentry);
+ 	error = PTR_ERR(dentry);
+ 	if (!IS_ERR(dentry)) {
+-		error = vfs_rmdir(nd.dentry->d_inode, dentry);
++		error = vfs_rmdir(nd.dentry->d_inode, dentry, &nd);
+ 		dput(dentry);
+ 	}
+ 	up(&nd.dentry->d_inode->i_sem);
+@@ -1817,9 +1823,10 @@ exit:
+ 	return error;
+ }
+ 
+-int vfs_unlink(struct inode *dir, struct dentry *dentry)
++int vfs_unlink(struct inode *dir, struct dentry *dentry,
++	struct nameidata *nd)
+ {
+-	int error = may_delete(dir, dentry, 0);
++	int error = may_delete(dir, dentry, 0, nd);
+ 
+ 	if (error)
+ 		return error;
+@@ -1881,7 +1888,7 @@ asmlinkage long sys_unlink(const char __
+ 		inode = dentry->d_inode;
+ 		if (inode)
+ 			atomic_inc(&inode->i_count);
+-		error = vfs_unlink(nd.dentry->d_inode, dentry);
++		error = vfs_unlink(nd.dentry->d_inode, dentry, &nd);
+ 	exit2:
+ 		dput(dentry);
+ 	}
+@@ -1900,9 +1907,10 @@ slashes:
+ 	goto exit2;
+ }
+ 
+-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode)
++int vfs_symlink(struct inode *dir, struct dentry *dentry,
++	const char *oldname, int mode, struct nameidata *nd)
+ {
+-	int error = may_create(dir, dentry, NULL);
++	int error = may_create(dir, dentry, nd);
+ 
+ 	if (error)
+ 		return error;
+@@ -1944,7 +1952,8 @@ asmlinkage long sys_symlink(const char _
+ 		dentry = lookup_create(&nd, 0);
+ 		error = PTR_ERR(dentry);
+ 		if (!IS_ERR(dentry)) {
+-			error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);
++			error = vfs_symlink(nd.dentry->d_inode, dentry,
++				from, S_IALLUGO, &nd);
+ 			dput(dentry);
+ 		}
+ 		up(&nd.dentry->d_inode->i_sem);
+@@ -1956,7 +1965,8 @@ out:
+ 	return error;
+ }
+ 
+-int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
++int vfs_link(struct dentry *old_dentry, struct inode *dir,
++	struct dentry *new_dentry, struct nameidata *nd)
+ {
+ 	struct inode *inode = old_dentry->d_inode;
+ 	int error;
+@@ -1964,7 +1974,7 @@ int vfs_link(struct dentry *old_dentry, 
+ 	if (!inode)
+ 		return -ENOENT;
+ 
+-	error = may_create(dir, new_dentry, NULL);
++	error = may_create(dir, new_dentry, nd);
+ 	if (error)
+ 		return error;
+ 
+@@ -2028,7 +2038,8 @@ asmlinkage long sys_link(const char __us
+ 	new_dentry = lookup_create(&nd, 0);
+ 	error = PTR_ERR(new_dentry);
+ 	if (!IS_ERR(new_dentry)) {
+-		error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
++		error = vfs_link(old_nd.dentry, nd.dentry->d_inode,
++			new_dentry, &nd);
+ 		dput(new_dentry);
+ 	}
+ 	up(&nd.dentry->d_inode->i_sem);
+@@ -2158,14 +2169,14 @@ int vfs_rename(struct inode *old_dir, st
+ 	if (old_dentry->d_inode == new_dentry->d_inode)
+  		return 0;
+  
+-	error = may_delete(old_dir, old_dentry, is_dir);
++	error = may_delete(old_dir, old_dentry, is_dir, NULL);
+ 	if (error)
+ 		return error;
+ 
+ 	if (!new_dentry->d_inode)
+ 		error = may_create(new_dir, new_dentry, NULL);
+ 	else
+-		error = may_delete(new_dir, new_dentry, is_dir);
++		error = may_delete(new_dir, new_dentry, is_dir, NULL);
+ 	if (error)
+ 		return error;
+ 
+@@ -2241,6 +2252,9 @@ static inline int do_rename(const char *
+ 	error = -EINVAL;
+ 	if (old_dentry == trap)
+ 		goto exit4;
++	error = -EROFS;
++	if (MNT_IS_RDONLY(newnd.mnt))
++		goto exit4;
+ 	new_dentry = lookup_hash(&newnd.last, new_dir);
+ 	error = PTR_ERR(new_dentry);
+ 	if (IS_ERR(new_dentry))
+diff -NurpP --minimal linux-2.6.11.5-vs1.9.5.3/fs/namespace.c linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/namespace.c
+--- linux-2.6.11.5-vs1.9.5.3/fs/namespace.c	2005-03-23 21:34:32 +0100
++++ linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/namespace.c	2005-03-26 00:20:19 +0100
+@@ -252,24 +252,26 @@ static int show_vfsmnt(struct seq_file *
+ 	struct vfsmount *mnt = v;
+ 	int err = 0;
+ 	static struct proc_fs_info {
+-		int flag;
+-		char *str;
++		int s_flag;
++		int mnt_flag;
++		char *set_str;
++		char *unset_str;
+ 	} fs_info[] = {
+-		{ MS_SYNCHRONOUS, ",sync" },
+-		{ MS_DIRSYNC, ",dirsync" },
+-		{ MS_MANDLOCK, ",mand" },
+-		{ MS_NOATIME, ",noatime" },
+-		{ MS_NODIRATIME, ",nodiratime" },
+-		{ MS_TAGXID, ",tagxid" },
+-		{ 0, NULL }
+-	};
+-	static struct proc_fs_info mnt_info[] = {
+-		{ MNT_NOSUID, ",nosuid" },
+-		{ MNT_NODEV, ",nodev" },
+-		{ MNT_NOEXEC, ",noexec" },
+-		{ 0, NULL }
++		{ MS_RDONLY, MNT_RDONLY, "ro", "rw" },
++		{ MS_SYNCHRONOUS, 0, ",sync", NULL },
++		{ MS_DIRSYNC, 0, ",dirsync", NULL },
++		{ MS_MANDLOCK, 0, ",mand", NULL },
++		{ MS_NOATIME, MNT_NOATIME, ",noatime", NULL },
++		{ MS_NODIRATIME, MNT_NODIRATIME, ",nodiratime", NULL },
++		{ 0, MNT_NOSUID, ",nosuid", NULL },
++		{ 0, MNT_NODEV, ",nodev", NULL },
++		{ 0, MNT_NOEXEC, ",noexec", NULL },
++		{ MS_TAGXID, 0, ",tagxid", NULL },
++		{ 0, 0, NULL, NULL }
+ 	};
+-	struct proc_fs_info *fs_infop;
++	struct proc_fs_info *p;
++	unsigned long s_flags = mnt->mnt_sb->s_flags;
++	int mnt_flags = mnt->mnt_flags;
+ 
+ 	if (vx_flags(VXF_HIDE_MOUNT, 0))
+ 		return 0;
+@@ -285,14 +287,15 @@ static int show_vfsmnt(struct seq_file *
+ 		seq_putc(m, ' ');
+ 	}
+ 	mangle(m, mnt->mnt_sb->s_type->name);
+-	seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? " ro" : " rw");
+-	for (fs_infop = fs_info; fs_infop->flag; fs_infop++) {
+-		if (mnt->mnt_sb->s_flags & fs_infop->flag)
+-			seq_puts(m, fs_infop->str);
+-	}
+-	for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) {
+-		if (mnt->mnt_flags & fs_infop->flag)
+-			seq_puts(m, fs_infop->str);
++	seq_putc(m, ' ');
++	for (p = fs_info; (p->s_flag | p->mnt_flag) ; p++) {
++		if ((s_flags & p->s_flag) || (mnt_flags & p->mnt_flag)) {
++			if (p->set_str)
++				seq_puts(m, p->set_str);
++		} else {
++			if (p->unset_str)
++				seq_puts(m, p->unset_str);
++		}
+ 	}
+ 	if (mnt->mnt_flags & MNT_XID)
+ 		seq_printf(m, ",xid=%d", mnt->mnt_xid);
+@@ -684,7 +687,8 @@ out_unlock:
+ /*
+  * do loopback mount.
+  */
+-static int do_loopback(struct nameidata *nd, char *old_name, xid_t xid, int flags)
++static int do_loopback(struct nameidata *nd, char *old_name,
++	xid_t xid, int flags, int mnt_flags)
+ {
+ 	struct nameidata old_nd;
+ 	struct vfsmount *mnt = NULL;
+@@ -725,6 +729,7 @@ static int do_loopback(struct nameidata 
+ 			spin_unlock(&vfsmount_lock);
+ 		} else
+ 			mntput(mnt);
++		mnt->mnt_flags = mnt_flags;
+ 	}
+ 
+ 	up_write(&current->namespace->sem);
+@@ -1112,12 +1117,18 @@ long do_mount(char * dev_name, char * di
+ 	}
+ 
+ 	/* Separate the per-mountpoint flags */
++	if (flags & MS_RDONLY)
++		mnt_flags |= MNT_RDONLY;
+ 	if (flags & MS_NOSUID)
+ 		mnt_flags |= MNT_NOSUID;
+ 	if (flags & MS_NODEV)
+ 		mnt_flags |= MNT_NODEV;
+ 	if (flags & MS_NOEXEC)
+ 		mnt_flags |= MNT_NOEXEC;
++	if (flags & MS_NOATIME)
++		mnt_flags |= MNT_NOATIME;
++	if (flags & MS_NODIRATIME)
++		mnt_flags |= MNT_NODIRATIME;
+ 	flags &= ~(MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_ACTIVE);
+ 
+ 	if (vx_ccaps(VXC_SECURE_MOUNT))
+@@ -1136,7 +1147,7 @@ long do_mount(char * dev_name, char * di
+ 		retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
+ 				    data_page, xid);
+ 	else if (flags & MS_BIND)
+-		retval = do_loopback(&nd, dev_name, xid, flags);
++		retval = do_loopback(&nd, dev_name, xid, flags, mnt_flags);
+ 	else if (flags & MS_MOVE)
+ 		retval = do_move_mount(&nd, dev_name);
+ 	else
+diff -NurpP --minimal linux-2.6.11.5-vs1.9.5.3/fs/nfs/dir.c linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/nfs/dir.c
+--- linux-2.6.11.5-vs1.9.5.3/fs/nfs/dir.c	2005-03-23 21:34:32 +0100
++++ linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/nfs/dir.c	2005-03-26 00:25:23 +0100
+@@ -773,7 +773,8 @@ static int is_atomic_open(struct inode *
+ 	if (nd->flags & LOOKUP_DIRECTORY)
+ 		return 0;
+ 	/* Are we trying to write to a read only partition? */
+-	if (IS_RDONLY(dir) && (nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE)))
++	if ((IS_RDONLY(dir) || MNT_IS_RDONLY(nd->mnt)) &&
++		(nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE)))
+ 		return 0;
+ 	return 1;
+ }
+diff -NurpP --minimal linux-2.6.11.5-vs1.9.5.3/fs/nfsd/vfs.c linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/nfsd/vfs.c
+--- linux-2.6.11.5-vs1.9.5.3/fs/nfsd/vfs.c	2005-03-02 12:38:45 +0100
++++ linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/nfsd/vfs.c	2005-03-26 00:25:23 +0100
+@@ -1115,13 +1115,13 @@ nfsd_create(struct svc_rqst *rqstp, stru
+ 		err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
+ 		break;
+ 	case S_IFDIR:
+-		err = vfs_mkdir(dirp, dchild, iap->ia_mode);
++		err = vfs_mkdir(dirp, dchild, iap->ia_mode, NULL);
+ 		break;
+ 	case S_IFCHR:
+ 	case S_IFBLK:
+ 	case S_IFIFO:
+ 	case S_IFSOCK:
+-		err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
++		err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev, NULL);
+ 		break;
+ 	default:
+ 	        printk("nfsd: bad file type %o in nfsd_create\n", type);
+@@ -1397,11 +1397,13 @@ nfsd_symlink(struct svc_rqst *rqstp, str
+ 		else {
+ 			strncpy(path_alloced, path, plen);
+ 			path_alloced[plen] = 0;
+-			err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
++			err = vfs_symlink(dentry->d_inode, dnew,
++				path_alloced, mode, NULL);
+ 			kfree(path_alloced);
+ 		}
+ 	} else
+-		err = vfs_symlink(dentry->d_inode, dnew, path, mode);
++		err = vfs_symlink(dentry->d_inode, dnew,
++			path, mode, NULL);
+ 
+ 	if (!err) {
+ 		if (EX_ISSYNC(fhp->fh_export))
+@@ -1459,7 +1461,7 @@ nfsd_link(struct svc_rqst *rqstp, struct
+ 	dold = tfhp->fh_dentry;
+ 	dest = dold->d_inode;
+ 
+-	err = vfs_link(dold, dirp, dnew);
++	err = vfs_link(dold, dirp, dnew, NULL);
+ 	if (!err) {
+ 		if (EX_ISSYNC(ffhp->fh_export)) {
+ 			nfsd_sync_dir(ddir);
+@@ -1620,9 +1622,9 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
+ 			err = nfserr_perm;
+ 		} else
+ #endif
+-		err = vfs_unlink(dirp, rdentry);
++		err = vfs_unlink(dirp, rdentry, NULL);
+ 	} else { /* It's RMDIR */
+-		err = vfs_rmdir(dirp, rdentry);
++		err = vfs_rmdir(dirp, rdentry, NULL);
+ 	}
+ 
+ 	dput(rdentry);
+@@ -1734,7 +1736,8 @@ nfsd_permission(struct svc_export *exp, 
+ 	 */
+ 	if (!(acc & MAY_LOCAL_ACCESS))
+ 		if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) {
+-			if (EX_RDONLY(exp) || IS_RDONLY(inode))
++			if (EX_RDONLY(exp) || IS_RDONLY(inode)
++				|| MNT_IS_RDONLY(exp->ex_mnt))
+ 				return nfserr_rofs;
+ 			if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode))
+ 				return nfserr_perm;
+diff -NurpP --minimal linux-2.6.11.5-vs1.9.5.3/fs/open.c linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/open.c
+--- linux-2.6.11.5-vs1.9.5.3/fs/open.c	2005-03-23 21:34:32 +0100
++++ linux-2.6.11.5-vs1.9.5.3-bme0.06.1/fs/open.c	2005-03-26 00:25:24 +0100
+@@ -244,7 +244,7 @@ static inline long do_sys_truncate(const
+ 		goto dput_and_out;
+ 
+ 	error = -EROFS;
+-	if (IS_RDONLY(inode))
++	if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
+ 		goto dput_and_out;
+ 
+ 	error = -EPERM;
+@@ -368,7 +368,7 @@ asmlinkage long sys_utime(char __user * 
+ 	inode = nd.dentry->d_inode;
+ 
+ 	error = -EROFS;
+-	if (IS_RDONLY(inode))
++	if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
+ 		goto dput_and_out;
+ 
+ 	/* Don't worry, the checks are done in inode_change_ok() */
+@@ -425,7 +425,7 @@ long do_utimes(char __user * filename, s
+ 	inode = nd.dentry->d_inode;
+ 
+ 	error = -EROFS;
+-	if (IS_RDONLY(inode))
++	if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
+ 		goto dput_and_out;
+ 
<<Diff was trimmed, longer than 597 lines>>



More information about the pld-cvs-commit mailing list