Move several *_SUPER_MAGIC symbols to include/linux/magic.h.
[pandora-kernel.git] / fs / fcntl.c
index 5f96786..d35cbc6 100644 (file)
@@ -73,8 +73,8 @@ repeat:
         * orig_start..fdt->next_fd
         */
        start = orig_start;
-       if (start < fdt->next_fd)
-               start = fdt->next_fd;
+       if (start < files->next_fd)
+               start = files->next_fd;
 
        newfd = start;
        if (start < fdt->max_fdset) {
@@ -102,9 +102,8 @@ repeat:
         * we reacquire the fdtable pointer and use it while holding
         * the lock, no one can free it during that time.
         */
-       fdt = files_fdtable(files);
-       if (start <= fdt->next_fd)
-               fdt->next_fd = newfd + 1;
+       if (start <= files->next_fd)
+               files->next_fd = newfd + 1;
 
        error = newfd;
        
@@ -208,8 +207,11 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
        struct inode * inode = filp->f_dentry->d_inode;
        int error = 0;
 
-       /* O_APPEND cannot be cleared if the file is marked as append-only */
-       if (!(arg & O_APPEND) && IS_APPEND(inode))
+       /*
+        * O_APPEND cannot be cleared if the file is marked as append-only
+        * and the file is open for write.
+        */
+       if (((arg ^ filp->f_flags) & O_APPEND) && IS_APPEND(inode))
                return -EPERM;
 
        /* O_NOATIME can only be set by the owner or superuser */
@@ -410,7 +412,7 @@ out:
 
 /* Table to convert sigio signal codes into poll band bitmaps */
 
-static long band_table[NSIGPOLL] = {
+static const long band_table[NSIGPOLL] = {
        POLLIN | POLLRDNORM,                    /* POLL_IN */
        POLLOUT | POLLWRNORM | POLLWRBAND,      /* POLL_OUT */
        POLLIN | POLLRDNORM | POLLMSG,          /* POLL_MSG */
@@ -451,8 +453,7 @@ static void send_sigio_to_task(struct task_struct *p,
                        /* Make sure we are called with one of the POLL_*
                           reasons, otherwise we could leak kernel stack into
                           userspace.  */
-                       if ((reason & __SI_MASK) != __SI_POLL)
-                               BUG();
+                       BUG_ON((reason & __SI_MASK) != __SI_POLL);
                        if (reason - POLL_IN >= NSIGPOLL)
                                si.si_band  = ~0L;
                        else
@@ -529,7 +530,7 @@ int send_sigurg(struct fown_struct *fown)
 }
 
 static DEFINE_RWLOCK(fasync_lock);
-static kmem_cache_t *fasync_cache;
+static kmem_cache_t *fasync_cache __read_mostly;
 
 /*
  * fasync_helper() is used by some character device drivers (mainly mice)