All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFS: Close a race in nfs42_proc_deallocate()
@ 2016-01-12 21:38 Anna Schumaker
  0 siblings, 0 replies; only message in thread
From: Anna Schumaker @ 2016-01-12 21:38 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs; +Cc: Anna.Schumaker

We need to take the i_mutex before writing back the inode to ensure that
the file doesn't change before calling DEALLOCATE.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/nfs42proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 6e81749..10d8eb4 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -122,8 +122,8 @@ int nfs42_proc_deallocate(struct file *filep, loff_t offset, loff_t len)
 	if (!nfs_server_capable(inode, NFS_CAP_DEALLOCATE))
 		return -EOPNOTSUPP;
 
-	nfs_wb_all(inode);
 	mutex_lock(&inode->i_mutex);
+	nfs_wb_all(inode);
 
 	err = nfs42_proc_fallocate(&msg, filep, offset, len);
 	if (err == 0)
-- 
2.7.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-12 21:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-12 21:38 [PATCH] NFS: Close a race in nfs42_proc_deallocate() Anna Schumaker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.