diff options
author | Sage Weil <sage@inktank.com> | 2013-08-09 09:57:58 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-09 17:55:48 -0700 |
commit | 2f75e9e17911524f294aa7b3bf0d7233f99a3218 (patch) | |
tree | 41d27b7e1c3b343d2a843e3ffe03b99cb1ee08f9 | |
parent | 0e5dd45ce4c41d3e3857116a77f34f04c99e78ad (diff) | |
download | linux-2f75e9e17911524f294aa7b3bf0d7233f99a3218.tar.bz2 |
ceph: replace hold_mutex flag with goto
All of the early exit paths need to drop the mutex; it is only the normal
path through the function that does not. Skip the unlock in that case
with a goto out_unlocked.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Jianpeng Ma <majianpeng@gmail.com>
-rw-r--r-- | fs/ceph/file.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 7478d5dbd1aa..a17ffe4ec3ca 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -710,13 +710,11 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov, &ceph_sb_to_client(inode->i_sb)->client->osdc; ssize_t count, written = 0; int err, want, got; - bool hold_mutex; if (ceph_snap(inode) != CEPH_NOSNAP) return -EROFS; mutex_lock(&inode->i_mutex); - hold_mutex = true; err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ); if (err) @@ -772,7 +770,6 @@ retry_snap: inode, ceph_vinop(inode), pos, (unsigned)iov->iov_len); mutex_lock(&inode->i_mutex); - hold_mutex = true; goto retry_snap; } } else { @@ -781,7 +778,6 @@ retry_snap: count, 0); mutex_unlock(&inode->i_mutex); } - hold_mutex = false; if (written >= 0) { int dirty; @@ -805,11 +801,12 @@ retry_snap: written = err; } + goto out_unlocked; + out: - if (hold_mutex) - mutex_unlock(&inode->i_mutex); + mutex_unlock(&inode->i_mutex); +out_unlocked: current->backing_dev_info = NULL; - return written ? written : err; } |