lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <e19db8d4e30d076af0c9dc46413ad1df@208suo.com>
Date:   Wed, 19 Jul 2023 18:17:53 +0800
From:   huzhi001@...suo.com
To:     trond.myklebust@...merspace.com, anna@...nel.org
Cc:     linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] NFSv4.1: Fix errors in nfs4state.c

Signed-off-by: ZhiHu <huzhi001@...suo.com>
---
  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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ