Whamcloud - gitweb
LU-1662 fid: missing unlock in seq_server_proc_write_width
authorwangdi <di.wang@whamcloud.com>
Mon, 23 Jul 2012 15:19:18 +0000 (08:19 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 26 Jul 2012 04:41:45 +0000 (00:41 -0400)
cfs_mutex_unlock(&seq->lcs_mutex) is missing in the error
handler of seq_server_proc_write_width.

Signed-off-by: wang di <di.wang@whamcloud.com>
Change-Id: I7b3c9ebceb40e06362a4f7c0b8e7fe5654c830ec
Reviewed-on: http://review.whamcloud.com/3451
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/fid/lproc_fid.c

index 7d3d1bb..27fd1f0 100644 (file)
@@ -181,20 +181,20 @@ seq_server_proc_write_width(struct file *file, const char *buffer,
 
         LASSERT(seq != NULL);
 
-        cfs_mutex_lock(&seq->lss_mutex);
-
-        rc = lprocfs_write_helper(buffer, count, &val);
-        if (rc)
-                RETURN(rc);
+       cfs_mutex_lock(&seq->lss_mutex);
 
-        seq->lss_width = val;
-
-       if (rc == 0) {
-               CDEBUG(D_INFO, "%s: Width: "LPU64"\n",
-                       seq->lss_name, seq->lss_width);
+       rc = lprocfs_write_helper(buffer, count, &val);
+       if (rc != 0) {
+               CERROR("%s: invalid width.\n", seq->lss_name);
+               GOTO(out_unlock, rc);
        }
 
-        cfs_mutex_unlock(&seq->lss_mutex);
+       seq->lss_width = val;
+
+       CDEBUG(D_INFO, "%s: Width: "LPU64"\n",
+              seq->lss_name, seq->lss_width);
+out_unlock:
+       cfs_mutex_unlock(&seq->lss_mutex);
 
         RETURN(count);
 }