Thread (48 messages) 48 messages, 16 authors, 2012-03-07
STALE5243d

[PATCH 2/2] btrfs: Don't have multiple paths to error out in btrfs_file_llseek

From: Andres Freund <hidden>
Date: 2011-10-01 20:50:04
Also in: lkml
Subsystem: btrfs file system, filesystems (vfs and infrastructure), the rest · Maintainers: Chris Mason, David Sterba, Alexander Viro, Christian Brauner, Linus Torvalds

Using multiple paths seems to invite overlooking one when adding new
stuff in the future.

Signed-of-by: Andres Freund [off-list ref]
---
 fs/btrfs/file.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 5bc7116..701c633 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1814,14 +1814,14 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin)
 
 	mutex_lock(&inode->i_mutex);
 	if (offset >= i_size_read(inode)) {
-		mutex_unlock(&inode->i_mutex);
-		return -ENXIO;
+		offset = -ENXIO;
+		goto out;
 	}
 
 	ret = find_desired_extent(inode, &offset, origin);
 	if (ret) {
-		mutex_unlock(&inode->i_mutex);
-		return ret;
+		offset = ret;
+		goto out;
 	}
 
 	if (offset < 0 && !(file->f_mode & FMODE_UNSIGNED_OFFSET)) {
-- 
1.7.6.409.ge7a85.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help