Skip to contentSkip to conversation

NFS: Close a race in nfs42_proc_deallocate()

PATCH New Anna Schumaker 1 participant 1 message Jan 12, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: Close a race in nfs42_proc_deallocate()

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

---
 fs/nfs/nfs42proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs42proc.c +1 -1
index 6e81749..10d8eb4 100644
@@ -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)
Signature · 1 line
2.7.0