Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / arch / sparc64 / solaris / fs.c
index a237c68..612477d 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/namei.h>
 #include <linux/mm.h>
@@ -362,7 +363,7 @@ static int report_statvfs(struct vfsmount *mnt, struct inode *inode, u32 buf)
                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 +399,7 @@ static int report_statvfs64(struct vfsmount *mnt, struct inode *inode, u32 buf)
                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;
@@ -600,23 +601,23 @@ asmlinkage int solaris_ulimit(int cmd, int val)
 {
        switch (cmd) {
        case 1: /* UL_GETFSIZE - in 512B chunks */
-               return current->rlim[RLIMIT_FSIZE].rlim_cur >> 9;
+               return current->signal->rlim[RLIMIT_FSIZE].rlim_cur >> 9;
        case 2: /* UL_SETFSIZE */
                if ((unsigned long)val > (LONG_MAX>>9)) return -ERANGE;
                val <<= 9;
-               lock_kernel();
-               if (val > current->rlim[RLIMIT_FSIZE].rlim_max) {
+               task_lock(current->group_leader);
+               if (val > current->signal->rlim[RLIMIT_FSIZE].rlim_max) {
                        if (!capable(CAP_SYS_RESOURCE)) {
-                               unlock_kernel();
+                               task_unlock(current->group_leader);
                                return -EPERM;
                        }
-                       current->rlim[RLIMIT_FSIZE].rlim_max = val;
+                       current->signal->rlim[RLIMIT_FSIZE].rlim_max = val;
                }
-               current->rlim[RLIMIT_FSIZE].rlim_cur = val;
-               unlock_kernel();
+               current->signal->rlim[RLIMIT_FSIZE].rlim_cur = val;
+               task_unlock(current->group_leader);
                return 0;
        case 3: /* UL_GMEMLIM */
-               return current->rlim[RLIMIT_DATA].rlim_cur;
+               return current->signal->rlim[RLIMIT_DATA].rlim_cur;
        case 4: /* UL_GDESLIM */
                return NR_OPEN;
        }