Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH] ceph: remove superfluous inode_lock in ceph_fsync
@ 2019-04-08 14:36 Jeff Layton
  2019-04-09  2:16 ` Yan, Zheng
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2019-04-08 14:36 UTC (permalink / raw)
  To: zyan, sage, idryomov; +Cc: ceph-devel, linux-fsdevel

Originally, filemap_write_and_wait took the i_mutex internally, but
commit 02c24a82187d pushed the mutex acquisition into the individual
fsync routines, leaving it up to the subsystem maintainers to remove
it if it wasn't needed.

For ceph, I see no reason to take the inode_lock here. All of the
operations inside that lock are protected by their own locking.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ceph/caps.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 36a8dc699448..f976939f771f 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2257,8 +2257,6 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 	if (datasync)
 		goto out;
 
-	inode_lock(inode);
-
 	dirty = try_flush_caps(inode, &flush_tid);
 	dout("fsync dirty caps are %s\n", ceph_cap_string(dirty));
 
@@ -2273,7 +2271,6 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 		ret = wait_event_interruptible(ci->i_cap_wq,
 					caps_are_flushed(inode, flush_tid));
 	}
-	inode_unlock(inode);
 out:
 	dout("fsync %p%s result=%d\n", inode, datasync ? " datasync" : "", ret);
 	return ret;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ceph: remove superfluous inode_lock in ceph_fsync
  2019-04-08 14:36 [PATCH] ceph: remove superfluous inode_lock in ceph_fsync Jeff Layton
@ 2019-04-09  2:16 ` Yan, Zheng
  0 siblings, 0 replies; 2+ messages in thread
From: Yan, Zheng @ 2019-04-09  2:16 UTC (permalink / raw)
  To: Jeff Layton, sage, idryomov; +Cc: ceph-devel, linux-fsdevel

On 4/8/19 10:36 PM, Jeff Layton wrote:
> Originally, filemap_write_and_wait took the i_mutex internally, but
> commit 02c24a82187d pushed the mutex acquisition into the individual
> fsync routines, leaving it up to the subsystem maintainers to remove
> it if it wasn't needed.
> 
> For ceph, I see no reason to take the inode_lock here. All of the
> operations inside that lock are protected by their own locking.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>   fs/ceph/caps.c | 3 ---
>   1 file changed, 3 deletions(-)
> 
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index 36a8dc699448..f976939f771f 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -2257,8 +2257,6 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
>   	if (datasync)
>   		goto out;
>   
> -	inode_lock(inode);
> -
>   	dirty = try_flush_caps(inode, &flush_tid);
>   	dout("fsync dirty caps are %s\n", ceph_cap_string(dirty));
>   
> @@ -2273,7 +2271,6 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
>   		ret = wait_event_interruptible(ci->i_cap_wq,
>   					caps_are_flushed(inode, flush_tid));
>   	}
> -	inode_unlock(inode);
>   out:
>   	dout("fsync %p%s result=%d\n", inode, datasync ? " datasync" : "", ret);
>   	return ret;
> 

Applied, thanks

Yan, Zheng

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-09  2:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-08 14:36 [PATCH] ceph: remove superfluous inode_lock in ceph_fsync Jeff Layton
2019-04-09  2:16 ` Yan, Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox