--- linux-2.6.13-vs2.0.1/arch/sparc64/solaris/fs.c	2004-12-25 01:54:50 +0100
+++ linux-2.6.13-vs2.0.1-bme0.06.1/arch/sparc64/solaris/fs.c	2005-09-14 03:39:57 +0200
@@ -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;
--- linux-2.6.13-vs2.0.1/arch/sparc64/solaris/fs.c	2004-12-25 01:54:50 +0100
+++ linux-2.6.13-vs2.0.1-bme0.06.1/arch/sparc64/solaris/fs.c	2005-09-14 03:39:57 +0200
@@ -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;
--- linux-2.6.13-vs2.0.1/fs/ext2/ioctl.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/ext2/ioctl.c	2005-09-14 03:39:57 +0200
@@ -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))
--- linux-2.6.13-vs2.0.1/fs/ext2/ioctl.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/ext2/ioctl.c	2005-09-14 03:39:57 +0200
@@ -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;	
--- linux-2.6.13-vs2.0.1/fs/ext3/ioctl.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/ext3/ioctl.c	2005-09-14 03:39:57 +0200
@@ -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))
--- linux-2.6.13-vs2.0.1/fs/ext3/ioctl.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/ext3/ioctl.c	2005-09-14 03:39:57 +0200
@@ -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;
--- linux-2.6.13-vs2.0.1/fs/ext3/ioctl.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/ext3/ioctl.c	2005-09-14 03:39:57 +0200
@@ -168,7 +170,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))
--- linux-2.6.13-vs2.0.1/fs/ext3/ioctl.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/ext3/ioctl.c	2005-09-14 03:39:57 +0200
@@ -203,7 +206,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))
--- linux-2.6.13-vs2.0.1/fs/ext3/ioctl.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/ext3/ioctl.c	2005-09-14 03:39:57 +0200
@@ -224,7 +228,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,
--- linux-2.6.13-vs2.0.1/fs/hfsplus/ioctl.c	2005-03-02 12:38:44 +0100
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/hfsplus/ioctl.c	2005-09-14 03:39:57 +0200
@@ -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))
--- linux-2.6.13-vs2.0.1/fs/namei.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/namei.c	2005-09-14 03:39:57 +0200
@@ -252,7 +252,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;
 
--- linux-2.6.13-vs2.0.1/fs/namei.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/namei.c	2005-09-14 03:39:57 +0200
@@ -1394,7 +1395,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.
--- linux-2.6.13-vs2.0.1/fs/namei.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/namei.c	2005-09-14 03:39:57 +0200
@@ -2320,6 +2331,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))
--- linux-2.6.13-vs2.0.1/fs/nfs/dir.c	2005-08-29 22:42:13 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/nfs/dir.c	2005-09-14 03:39:57 +0200
@@ -910,7 +910,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;
 }
--- linux-2.6.13-vs2.0.1/fs/nfsd/vfs.c	2005-08-29 22:25:32 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/nfsd/vfs.c	2005-09-14 03:39:57 +0200
@@ -1773,7 +1775,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;
--- 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
@@ -245,7 +245,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;
--- 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
@@ -369,7 +369,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() */
--- 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
@@ -426,7 +426,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;
 
 	/* Don't worry, the checks are done in inode_change_ok() */
--- 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
@@ -508,7 +508,8 @@ asmlinkage long sys_access(const char __
 	if (!res) {
 		res = permission(nd.dentry->d_inode, mode, &nd);
 		/* SuS v2 requires we report a read only fs too */
-		if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
+		if(!res && (mode & S_IWOTH)
+		   && (IS_RDONLY(nd.dentry->d_inode) || MNT_IS_RDONLY(nd.mnt))
 		   && !special_file(nd.dentry->d_inode->i_mode))
 			res = -EROFS;
 		path_release(&nd);
--- 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
@@ -614,7 +615,7 @@ asmlinkage long sys_fchmod(unsigned int 
 	inode = dentry->d_inode;
 
 	err = -EROFS;
-	if (IS_RDONLY(inode))
+	if (IS_RDONLY(inode) || MNT_IS_RDONLY(file->f_vfsmnt))
 		goto out_putf;
 	err = -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
@@ -646,7 +647,7 @@ asmlinkage long sys_chmod(const char __u
 	inode = nd.dentry->d_inode;
 
 	error = -EROFS;
-	if (IS_RDONLY(inode))
+	if (IS_RDONLY(inode) || MNT_IS_RDONLY(nd.mnt))
 		goto dput_and_out;
 
 	error = -EPERM;
--- linux-2.6.13-vs2.0.1/fs/reiserfs/ioctl.c	2005-08-30 12:10:34 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/reiserfs/ioctl.c	2005-09-14 03:46:01 +0200
@@ -47,8 +47,8 @@ int reiserfs_ioctl(struct inode *inode, 
 			if (!reiserfs_attrs(inode->i_sb))
 				return -ENOTTY;
 
-			if (IS_RDONLY(inode))
-				return -EROFS;
+			if (IS_RDONLY(inode) ||
+				(filp && MNT_IS_RDONLY(filp->f_vfsmnt)))
 
 			if ((current->fsuid != inode->i_uid)
 			    && !capable(CAP_FOWNER))
--- linux-2.6.13-vs2.0.1/fs/reiserfs/ioctl.c	2005-08-30 12:10:34 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/reiserfs/ioctl.c	2005-09-14 03:46:01 +0200
@@ -87,7 +87,8 @@ int reiserfs_ioctl(struct inode *inode, 
 	case REISERFS_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;
--- linux-2.6.13-vs2.0.1/fs/reiserfs/xattr.c	2005-08-29 22:25:33 +0200
+++ linux-2.6.13-vs2.0.1-bme0.06.1/fs/reiserfs/xattr.c	2005-09-14 03:45:41 +0200
@@ -1352,7 +1352,7 @@ __reiserfs_permission(struct inode *inod
 		/*
 		 * 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;
 
