[PATCH] NFSv4.1: Fix errors in nfs4state.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: ZhiHu <huzhi001@xxxxxxxxxx>
---
 fs/nfs/nfs4state.c | 58 ++++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index bbe49315d99e..8fedb9a4efd5 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -788,14 +788,14 @@ static void __nfs4_close(struct nfs4_state *state,
     /* Protect against nfs4_find_state() */
     spin_lock(&owner->so_lock);
     switch (fmode & (FMODE_READ | FMODE_WRITE)) {
-        case FMODE_READ:
-            state->n_rdonly--;
-            break;
-        case FMODE_WRITE:
-            state->n_wronly--;
-            break;
-        case FMODE_READ|FMODE_WRITE:
-            state->n_rdwr--;
+    case FMODE_READ:
+        state->n_rdonly--;
+        break;
+    case FMODE_WRITE:
+        state->n_wronly--;
+        break;
+    case FMODE_READ|FMODE_WRITE:
+        state->n_rdwr--;
     }
     newstate = FMODE_READ|FMODE_WRITE;
     if (state->n_rdwr == 0) {
@@ -905,9 +905,8 @@ void nfs4_free_lock_state(struct nfs_server *server, struct nfs4_lock_state *lsp static struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t owner)
 {
     struct nfs4_lock_state *lsp, *new = NULL;
-
     for(;;) {
-        spin_lock(&state->state_lock);
+        spin_lock (&state->state_lock);
         lsp = __nfs4_find_lock_state(state, owner, NULL);
         if (lsp != NULL)
             break;
@@ -1120,25 +1119,25 @@ void nfs_free_seqid(struct nfs_seqid *seqid)
 static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
 {
     switch (status) {
-        case 0:
-            break;
-        case -NFS4ERR_BAD_SEQID:
-            if (seqid->sequence->flags & NFS_SEQID_CONFIRMED)
-                return;
-            pr_warn_ratelimited("NFS: v4 server returned a bad"
-                    " sequence-id error on an"
-                    " unconfirmed sequence %p!\n",
-                    seqid->sequence);
-            return;
-        case -NFS4ERR_STALE_CLIENTID:
-        case -NFS4ERR_STALE_STATEID:
-        case -NFS4ERR_BAD_STATEID:
-        case -NFS4ERR_BADXDR:
-        case -NFS4ERR_RESOURCE:
-        case -NFS4ERR_NOFILEHANDLE:
-        case -NFS4ERR_MOVED:
-            /* Non-seqid mutating errors */
+    case 0:
+        break;
+    case -NFS4ERR_BAD_SEQID:
+        if (seqid->sequence->flags & NFS_SEQID_CONFIRMED)
             return;
+        pr_warn_ratelimited("NFS: v4 server returned a bad"
+                " sequence-id error on an"
+                " unconfirmed sequence %p!\n",
+                seqid->sequence);
+        return;
+    case -NFS4ERR_STALE_CLIENTID:
+    case -NFS4ERR_STALE_STATEID:
+    case -NFS4ERR_BAD_STATEID:
+    case -NFS4ERR_BADXDR:
+    case -NFS4ERR_RESOURCE:
+    case -NFS4ERR_NOFILEHANDLE:
+    case -NFS4ERR_MOVED:
+        /* Non-seqid mutating errors */
+        return;
     }
     /*
      * Note: no locking needed as we are guaranteed to be first
@@ -1335,7 +1334,7 @@ int nfs4_client_recover_expired_lease(struct nfs_client *clp)
         if (ret != 0)
             break;
         if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) &&
-            !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state))
+            !test_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state))
             break;
         nfs4_schedule_state_manager(clp);
         ret = -EIO;
@@ -1643,7 +1642,6 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp,
 #ifdef CONFIG_NFS_V4_2
     bool found_ssc_copy_state = false;
 #endif /* CONFIG_NFS_V4_2 */
-
     /* Note: we rely on the sp->so_states list being ordered
      * so that we always reclaim open(O_RDWR) and/or open(O_WRITE)
      * states first.



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux