Merge branch 'nfs-for-2.6.33'
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 13 Dec 2009 18:56:27 +0000 (13:56 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 13 Dec 2009 18:56:27 +0000 (13:56 -0500)
1  2 
fs/nfs/write.c
net/sunrpc/auth.c
net/sunrpc/xprtsock.c

diff --combined fs/nfs/write.c
@@@ -178,7 -178,7 +178,7 @@@ static int wb_priority(struct writeback
  {
        if (wbc->for_reclaim)
                return FLUSH_HIGHPRI | FLUSH_STABLE;
 -      if (wbc->for_kupdate)
 +      if (wbc->for_kupdate || wbc->for_background)
                return FLUSH_LOWPRI;
        return 0;
  }
@@@ -774,7 -774,7 +774,7 @@@ int nfs_updatepage(struct file *file, s
         */
        if (nfs_write_pageuptodate(page, inode) &&
                        inode->i_flock == NULL &&
 -                      !(file->f_flags & O_SYNC)) {
 +                      !(file->f_flags & O_DSYNC)) {
                count = max(count + offset, nfs_page_length(page));
                offset = 0;
        }
@@@ -1216,7 -1216,7 +1216,7 @@@ int nfs_writeback_done(struct rpc_task 
                                 */
                                argp->stable = NFS_FILE_SYNC;
                        }
-                       nfs4_restart_rpc(task, server->nfs_client);
+                       nfs_restart_rpc(task, server->nfs_client);
                        return -EAGAIN;
                }
                if (time_before(complain, jiffies)) {
                /* Can't do anything about it except throw an error. */
                task->tk_status = -EIO;
        }
-       nfs4_sequence_free_slot(server->nfs_client, &data->res.seq_res);
        return 0;
  }
  
@@@ -1612,15 -1611,16 +1611,16 @@@ int nfs_migrate_page(struct address_spa
        if (ret)
                goto out_unlock;
        page_cache_get(newpage);
+       spin_lock(&mapping->host->i_lock);
        req->wb_page = newpage;
        SetPagePrivate(newpage);
-       set_page_private(newpage, page_private(page));
+       set_page_private(newpage, (unsigned long)req);
        ClearPagePrivate(page);
        set_page_private(page, 0);
+       spin_unlock(&mapping->host->i_lock);
        page_cache_release(page);
  out_unlock:
        nfs_clear_page_tag_locked(req);
-       nfs_release_request(req);
  out:
        return ret;
  }
diff --combined net/sunrpc/auth.c
@@@ -123,16 -123,19 +123,19 @@@ rpcauth_unhash_cred_locked(struct rpc_c
        clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags);
  }
  
- static void
+ static int
  rpcauth_unhash_cred(struct rpc_cred *cred)
  {
        spinlock_t *cache_lock;
+       int ret;
  
        cache_lock = &cred->cr_auth->au_credcache->lock;
        spin_lock(cache_lock);
-       if (atomic_read(&cred->cr_count) == 0)
+       ret = atomic_read(&cred->cr_count) == 0;
+       if (ret)
                rpcauth_unhash_cred_locked(cred);
        spin_unlock(cache_lock);
+       return ret;
  }
  
  /*
@@@ -332,9 -335,9 +335,9 @@@ rpcauth_lookup_credcache(struct rpc_aut
                list_add_tail(&new->cr_lru, &free);
        spin_unlock(&cache->lock);
  found:
 -      if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags)
 -                      && cred->cr_ops->cr_init != NULL
 -                      && !(flags & RPCAUTH_LOOKUP_NEW)) {
 +      if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags) &&
 +          cred->cr_ops->cr_init != NULL &&
 +          !(flags & RPCAUTH_LOOKUP_NEW)) {
                int res = cred->cr_ops->cr_init(auth, cred);
                if (res < 0) {
                        put_rpccred(cred);
@@@ -446,31 -449,35 +449,35 @@@ voi
  put_rpccred(struct rpc_cred *cred)
  {
        /* Fast path for unhashed credentials */
-       if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0)
-               goto need_lock;
-       if (!atomic_dec_and_test(&cred->cr_count))
+       if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) == 0) {
+               if (atomic_dec_and_test(&cred->cr_count))
+                       cred->cr_ops->crdestroy(cred);
                return;
-       goto out_destroy;
- need_lock:
+       }
        if (!atomic_dec_and_lock(&cred->cr_count, &rpc_credcache_lock))
                return;
        if (!list_empty(&cred->cr_lru)) {
                number_cred_unused--;
                list_del_init(&cred->cr_lru);
        }
-       if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) == 0)
-               rpcauth_unhash_cred(cred);
        if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) {
-               cred->cr_expire = jiffies;
-               list_add_tail(&cred->cr_lru, &cred_unused);
-               number_cred_unused++;
-               spin_unlock(&rpc_credcache_lock);
-               return;
+               if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0) {
+                       cred->cr_expire = jiffies;
+                       list_add_tail(&cred->cr_lru, &cred_unused);
+                       number_cred_unused++;
+                       goto out_nodestroy;
+               }
+               if (!rpcauth_unhash_cred(cred)) {
+                       /* We were hashed and someone looked us up... */
+                       goto out_nodestroy;
+               }
        }
        spin_unlock(&rpc_credcache_lock);
- out_destroy:
        cred->cr_ops->crdestroy(cred);
+       return;
+ out_nodestroy:
+       spin_unlock(&rpc_credcache_lock);
  }
  EXPORT_SYMBOL_GPL(put_rpccred);
  
diff --combined net/sunrpc/xprtsock.c
@@@ -81,38 -81,46 +81,38 @@@ static struct ctl_table_header *sunrpc_
   */
  static ctl_table xs_tunables_table[] = {
        {
 -              .ctl_name       = CTL_SLOTTABLE_UDP,
                .procname       = "udp_slot_table_entries",
                .data           = &xprt_udp_slot_table_entries,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
 -              .proc_handler   = &proc_dointvec_minmax,
 -              .strategy       = &sysctl_intvec,
 +              .proc_handler   = proc_dointvec_minmax,
                .extra1         = &min_slot_table_size,
                .extra2         = &max_slot_table_size
        },
        {
 -              .ctl_name       = CTL_SLOTTABLE_TCP,
                .procname       = "tcp_slot_table_entries",
                .data           = &xprt_tcp_slot_table_entries,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
 -              .proc_handler   = &proc_dointvec_minmax,
 -              .strategy       = &sysctl_intvec,
 +              .proc_handler   = proc_dointvec_minmax,
                .extra1         = &min_slot_table_size,
                .extra2         = &max_slot_table_size
        },
        {
 -              .ctl_name       = CTL_MIN_RESVPORT,
                .procname       = "min_resvport",
                .data           = &xprt_min_resvport,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
 -              .proc_handler   = &proc_dointvec_minmax,
 -              .strategy       = &sysctl_intvec,
 +              .proc_handler   = proc_dointvec_minmax,
                .extra1         = &xprt_min_resvport_limit,
                .extra2         = &xprt_max_resvport_limit
        },
        {
 -              .ctl_name       = CTL_MAX_RESVPORT,
                .procname       = "max_resvport",
                .data           = &xprt_max_resvport,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
 -              .proc_handler   = &proc_dointvec_minmax,
 -              .strategy       = &sysctl_intvec,
 +              .proc_handler   = proc_dointvec_minmax,
                .extra1         = &xprt_min_resvport_limit,
                .extra2         = &xprt_max_resvport_limit
        },
                .data           = &xs_tcp_fin_timeout,
                .maxlen         = sizeof(xs_tcp_fin_timeout),
                .mode           = 0644,
 -              .proc_handler   = &proc_dointvec_jiffies,
 -              .strategy       = sysctl_jiffies
 -      },
 -      {
 -              .ctl_name = 0,
 +              .proc_handler   = proc_dointvec_jiffies,
        },
 +      { },
  };
  
  static ctl_table sunrpc_table[] = {
        {
 -              .ctl_name       = CTL_SUNRPC,
                .procname       = "sunrpc",
                .mode           = 0555,
                .child          = xs_tunables_table
        },
 -      {
 -              .ctl_name = 0,
 -      },
 +      { },
  };
  
  #endif
@@@ -2019,7 -2033,7 +2019,7 @@@ static void xs_connect(struct rpc_task 
        if (xprt_test_and_set_connecting(xprt))
                return;
  
-       if (transport->sock != NULL) {
+       if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) {
                dprintk("RPC:       xs_connect delayed xprt %p for %lu "
                                "seconds\n",
                                xprt, xprt->reestablish_timeout / HZ);