Skip to contentSkip to conversation

NFS: struct nfs_commit_info.lock must always point to inode->i_lock

PATCH New Trond Myklebust 1 participant 1 message Feb 14, 2015

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

PATCH 1/1 NFS: struct nfs_commit_info.lock must always point to inode->i_lock

Commit 411a99adffb4f (nfs: clear_request_commit while holding i_lock) assumes that the nfs_commit_info always points to the inode->i_lock. For historical reasons, that is not the case for O_DIRECT writes.

Cc Weston Andros Adamson <[email protected]>
Fixes 411a99adffb4f ("nfs: clear_request_commit while holding i_lock")
Cc [email protected] # 3.17.x
---
 fs/nfs/direct.c         | 2 +-
 include/linux/nfs_xdr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/nfs/direct.c +1 -1
index 7077521acdf4..e907c8cf732e 100644
@@ -283,7 +283,7 @@ static void nfs_direct_release_pages(struct page **pages, unsigned int npages)
 void nfs_init_cinfo_from_dreq(struct nfs_commit_info *cinfo,
 			      struct nfs_direct_req *dreq)
 {
-	cinfo->lock = &dreq->lock;
+	cinfo->lock = &dreq->inode->i_lock;
 	cinfo->mds = &dreq->mds_cinfo;
 	cinfo->ds = &dreq->ds_cinfo;
 	cinfo->dreq = dreq;
include/linux/nfs_xdr.h +1 -1
index 38d96ba935c2..9a39132fda49 100644
@@ -1351,7 +1351,7 @@ struct nfs_commit_completion_ops {
 };
 
 struct nfs_commit_info {
-	spinlock_t			*lock;
+	spinlock_t			*lock;	/* inode->i_lock */
 	struct nfs_mds_commit_info	*mds;
 	struct pnfs_ds_commit_info	*ds;
 	struct nfs_direct_req		*dreq;	/* O_DIRECT request */
Signature · 1 line
2.1.0