Merge branch 'for-2.6.27' of git://linux-nfs.org/~bfields/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 21 Jul 2008 04:21:46 +0000 (21:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 21 Jul 2008 04:21:46 +0000 (21:21 -0700)
* 'for-2.6.27' of git://linux-nfs.org/~bfields/linux: (51 commits)
  nfsd: nfs4xdr.c do-while is not a compound statement
  nfsd: Use C99 initializers in fs/nfsd/nfs4xdr.c
  lockd: Pass "struct sockaddr *" to new failover-by-IP function
  lockd: get host reference in nlmsvc_create_block() instead of callers
  lockd: minor svclock.c style fixes
  lockd: eliminate duplicate nlmsvc_lookup_host call from nlmsvc_lock
  lockd: eliminate duplicate nlmsvc_lookup_host call from nlmsvc_testlock
  lockd: nlm_release_host() checks for NULL, caller needn't
  file lock: reorder struct file_lock to save space on 64 bit builds
  nfsd: take file and mnt write in nfs4_upgrade_open
  nfsd: document open share bit tracking
  nfsd: tabulate nfs4 xdr encoding functions
  nfsd: dprint operation names
  svcrdma: Change WR context get/put to use the kmem cache
  svcrdma: Create a kmem cache for the WR contexts
  svcrdma: Add flush_scheduled_work to module exit function
  svcrdma: Limit ORD based on client's advertised IRD
  svcrdma: Remove unused wait q from svcrdma_xprt structure
  svcrdma: Remove unneeded spin locks from __svc_rdma_free
  svcrdma: Add dma map count and WARN_ON
  ...

1  2 
fs/lockd/svc4proc.c
fs/lockd/svclock.c
fs/lockd/svcproc.c
include/linux/fs.h

diff --combined fs/lockd/svc4proc.c
@@@ -58,8 -58,7 +58,7 @@@ nlm4svc_retrieve_args(struct svc_rqst *
        return 0;
  
  no_locks:
-       if (host)
-               nlm_release_host(host);
+       nlm_release_host(host);
        if (error)
                return error;   
        return nlm_lck_denied_nolocks;
@@@ -100,7 -99,7 +99,7 @@@ nlm4svc_proc_test(struct svc_rqst *rqst
                return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
  
        /* Now check for conflicting locks */
-       resp->status = nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie);
+       resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie);
        if (resp->status == nlm_drop_reply)
                rc = rpc_drop_reply;
        else
@@@ -146,7 -145,7 +145,7 @@@ nlm4svc_proc_lock(struct svc_rqst *rqst
  #endif
  
        /* Now try to lock the file */
-       resp->status = nlmsvc_lock(rqstp, file, &argp->lock,
+       resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock,
                                        argp->block, &argp->cookie);
        if (resp->status == nlm_drop_reply)
                rc = rpc_drop_reply;
@@@ -248,9 -247,7 +247,9 @@@ static void nlm4svc_callback_exit(struc
  
  static void nlm4svc_callback_release(void *data)
  {
 +      lock_kernel();
        nlm_release_call(data);
 +      unlock_kernel();
  }
  
  static const struct rpc_call_ops nlm4svc_callback_ops = {
diff --combined fs/lockd/svclock.c
@@@ -129,9 -129,9 +129,9 @@@ nlmsvc_lookup_block(struct nlm_file *fi
  
  static inline int nlm_cookie_match(struct nlm_cookie *a, struct nlm_cookie *b)
  {
-       if(a->len != b->len)
+       if (a->len != b->len)
                return 0;
-       if(memcmp(a->data,b->data,a->len))
+       if (memcmp(a->data, b->data, a->len))
                return 0;
        return 1;
  }
@@@ -180,6 -180,7 +180,7 @@@ nlmsvc_create_block(struct svc_rqst *rq
        struct nlm_block        *block;
        struct nlm_rqst         *call = NULL;
  
+       nlm_get_host(host);
        call = nlm_alloc_call(host);
        if (call == NULL)
                return NULL;
@@@ -358,10 -359,10 +359,10 @@@ nlmsvc_defer_lock_rqst(struct svc_rqst 
   */
  __be32
  nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
-                       struct nlm_lock *lock, int wait, struct nlm_cookie *cookie)
+           struct nlm_host *host, struct nlm_lock *lock, int wait,
+           struct nlm_cookie *cookie)
  {
        struct nlm_block        *block = NULL;
-       struct nlm_host         *host;
        int                     error;
        __be32                  ret;
  
                                (long long)lock->fl.fl_end,
                                wait);
  
-       /* Create host handle for callback */
-       host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len);
-       if (host == NULL)
-               return nlm_lck_denied_nolocks;
        /* Lock file against concurrent access */
        mutex_lock(&file->f_mutex);
        /* Get existing block (in case client is busy-waiting)
         */
        block = nlmsvc_lookup_block(file, lock);
        if (block == NULL) {
-               block = nlmsvc_create_block(rqstp, nlm_get_host(host), file,
-                               lock, cookie);
+               block = nlmsvc_create_block(rqstp, host, file, lock, cookie);
                ret = nlm_lck_denied_nolocks;
                if (block == NULL)
                        goto out;
        lock->fl.fl_flags &= ~FL_SLEEP;
  
        dprintk("lockd: vfs_lock_file returned %d\n", error);
-       switch(error) {
+       switch (error) {
                case 0:
                        ret = nlm_granted;
                        goto out;
  out:
        mutex_unlock(&file->f_mutex);
        nlmsvc_release_block(block);
-       nlm_release_host(host);
        dprintk("lockd: nlmsvc_lock returned %u\n", ret);
        return ret;
  }
   */
  __be32
  nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
-               struct nlm_lock *lock, struct nlm_lock *conflock,
-               struct nlm_cookie *cookie)
+               struct nlm_host *host, struct nlm_lock *lock,
+               struct nlm_lock *conflock, struct nlm_cookie *cookie)
  {
        struct nlm_block        *block = NULL;
        int                     error;
  
        if (block == NULL) {
                struct file_lock *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
-               struct nlm_host *host;
  
                if (conf == NULL)
                        return nlm_granted;
-               /* Create host handle for callback */
-               host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len);
-               if (host == NULL) {
-                       kfree(conf);
-                       return nlm_lck_denied_nolocks;
-               }
                block = nlmsvc_create_block(rqstp, host, file, lock, cookie);
                if (block == NULL) {
                        kfree(conf);
@@@ -795,7 -782,6 +782,7 @@@ static void nlmsvc_grant_callback(struc
  
        dprintk("lockd: GRANT_MSG RPC callback\n");
  
 +      lock_kernel();
        /* if the block is not on a list at this point then it has
         * been invalidated. Don't try to requeue it.
         *
         * for nlm_blocked?
         */
        if (list_empty(&block->b_list))
 -              return;
 +              goto out;
  
        /* Technically, we should down the file semaphore here. Since we
         * move the block towards the head of the queue only, no harm
        }
        nlmsvc_insert_block(block, timeout);
        svc_wake_up(block->b_daemon);
 +out:
 +      unlock_kernel();
  }
  
  static void nlmsvc_grant_release(void *data)
  {
        struct nlm_rqst         *call = data;
  
 +      lock_kernel();
        nlmsvc_release_block(call->a_block);
 +      unlock_kernel();
  }
  
  static const struct rpc_call_ops nlmsvc_grant_ops = {
@@@ -897,7 -879,7 +884,7 @@@ nlmsvc_retry_blocked(void
  
                if (block->b_when == NLM_NEVER)
                        break;
-               if (time_after(block->b_when,jiffies)) {
+               if (time_after(block->b_when, jiffies)) {
                        timeout = block->b_when - jiffies;
                        break;
                }
diff --combined fs/lockd/svcproc.c
@@@ -87,8 -87,7 +87,7 @@@ nlmsvc_retrieve_args(struct svc_rqst *r
        return 0;
  
  no_locks:
-       if (host)
-               nlm_release_host(host);
+       nlm_release_host(host);
        if (error)
                return error;
        return nlm_lck_denied_nolocks;
@@@ -129,7 -128,7 +128,7 @@@ nlmsvc_proc_test(struct svc_rqst *rqstp
                return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
  
        /* Now check for conflicting locks */
-       resp->status = cast_status(nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie));
+       resp->status = cast_status(nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie));
        if (resp->status == nlm_drop_reply)
                rc = rpc_drop_reply;
        else
@@@ -176,7 -175,7 +175,7 @@@ nlmsvc_proc_lock(struct svc_rqst *rqstp
  #endif
  
        /* Now try to lock the file */
-       resp->status = cast_status(nlmsvc_lock(rqstp, file, &argp->lock,
+       resp->status = cast_status(nlmsvc_lock(rqstp, file, host, &argp->lock,
                                               argp->block, &argp->cookie));
        if (resp->status == nlm_drop_reply)
                rc = rpc_drop_reply;
@@@ -278,9 -277,7 +277,9 @@@ static void nlmsvc_callback_exit(struc
  
  static void nlmsvc_callback_release(void *data)
  {
 +      lock_kernel();
        nlm_release_call(data);
 +      unlock_kernel();
  }
  
  static const struct rpc_call_ops nlmsvc_callback_ops = {
diff --combined include/linux/fs.h
@@@ -83,7 -83,6 +83,7 @@@ extern int dir_notify_enable
  #define READ_SYNC     (READ | (1 << BIO_RW_SYNC))
  #define READ_META     (READ | (1 << BIO_RW_META))
  #define WRITE_SYNC    (WRITE | (1 << BIO_RW_SYNC))
 +#define SWRITE_SYNC   (SWRITE | (1 << BIO_RW_SYNC))
  #define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
  
  #define SEL_IN                1
@@@ -918,12 -917,12 +918,12 @@@ struct file_lock 
        struct list_head fl_link;       /* doubly linked list of all locks */
        struct list_head fl_block;      /* circular list of blocked processes */
        fl_owner_t fl_owner;
+       unsigned char fl_flags;
+       unsigned char fl_type;
        unsigned int fl_pid;
        struct pid *fl_nspid;
        wait_queue_head_t fl_wait;
        struct file *fl_file;
-       unsigned char fl_flags;
-       unsigned char fl_type;
        loff_t fl_start;
        loff_t fl_end;
  
@@@ -1729,8 -1728,6 +1729,8 @@@ static inline void invalidate_remote_in
  extern int invalidate_inode_pages2(struct address_space *mapping);
  extern int invalidate_inode_pages2_range(struct address_space *mapping,
                                         pgoff_t start, pgoff_t end);
 +extern void generic_sync_sb_inodes(struct super_block *sb,
 +                              struct writeback_control *wbc);
  extern int write_inode_now(struct inode *, int);
  extern int filemap_fdatawrite(struct address_space *);
  extern int filemap_flush(struct address_space *);
@@@ -1742,8 -1739,6 +1742,8 @@@ extern int wait_on_page_writeback_range
                                pgoff_t start, pgoff_t end);
  extern int __filemap_fdatawrite_range(struct address_space *mapping,
                                loff_t start, loff_t end, int sync_mode);
 +extern int filemap_fdatawrite_range(struct address_space *mapping,
 +                              loff_t start, loff_t end);
  
  extern long do_fsync(struct file *file, int datasync);
  extern void sync_supers(void);
@@@ -1874,8 -1869,7 +1874,8 @@@ extern voi
  file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
  extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
  extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
 -extern loff_t remote_llseek(struct file *file, loff_t offset, int origin);
 +extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset,
 +                      int origin);
  extern int generic_file_open(struct inode * inode, struct file * filp);
  extern int nonseekable_open(struct inode * inode, struct file * filp);