Skip to contentSkip to conversation

fs/ceph: fix comments mentioning i_mutex

PATCH In review Hongnan Li 2 participants 2 messages Feb 11, 2022 Ceph client

lore
Share & tools
lore

Hongnan Li

author
#0 lore raw

PATCH 1/1 fs/ceph: fix comments mentioning i_mutex

From: hongnanli <[email protected]>

inode->i_mutex has been replaced with inode->i_rwsem long ago. Fix comments still mentioning i_mutex.

---
 fs/ceph/dir.c   | 6 +++---
 fs/ceph/inode.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
fs/ceph/dir.c +3 -3
index 133dbd9338e7..0cf6afe283e9 100644
@@ -145,7 +145,7 @@ __dcache_find_get_entry(struct dentry *parent, u64 idx,
 			return ERR_PTR(-EAGAIN);
 		}
 		/* reading/filling the cache are serialized by
-		   i_mutex, no need to use page lock */
+		   i_rwsem, no need to use page lock */
 		unlock_page(cache_ctl->page);
 		cache_ctl->dentries = kmap(cache_ctl->page);
 	}
@@ -155,7 +155,7 @@ __dcache_find_get_entry(struct dentry *parent, u64 idx,
 	rcu_read_lock();
 	spin_lock(&parent->d_lock);
 	/* check i_size again here, because empty directory can be
-	 * marked as complete while not holding the i_mutex. */
+	 * marked as complete while not holding the i_rwsem. */
 	if (ceph_dir_is_complete_ordered(dir) && ptr_pos < i_size_read(dir))
 		dentry = cache_ctl->dentries[cache_ctl->index];
 	else
@@ -671,7 +671,7 @@ struct dentry *ceph_handle_snapdir(struct ceph_mds_request *req,
 				   struct dentry *dentry)
 {
 	struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
-	struct inode *parent = d_inode(dentry->d_parent); /* we hold i_mutex */
+	struct inode *parent = d_inode(dentry->d_parent); /* we hold i_rwsem */
 
 	/* .snap dir? */
 	if (ceph_snap(parent) == CEPH_NOSNAP &&
fs/ceph/inode.c +2 -2
index ef4a980a7bf3..22adddb3d051 100644
@@ -1201,7 +1201,7 @@ static void update_dentry_lease_careful(struct dentry *dentry,
 
 /*
  * splice a dentry to an inode.
- * caller must hold directory i_mutex for this to be safe.
+ * caller must hold directory i_rwsem for this to be safe.
  */
 static int splice_dentry(struct dentry **pdn, struct inode *in)
 {
@@ -1598,7 +1598,7 @@ static int fill_readdir_cache(struct inode *dir, struct dentry *dn,
 			return idx == 0 ? -ENOMEM : 0;
 		}
 		/* reading/filling the cache are serialized by
-		 * i_mutex, no need to use page lock */
+		 * i_rwsem, no need to use page lock */
 		unlock_page(ctl->page);
 		ctl->dentries = kmap(ctl->page);
 		if (idx == 0)
Signature · 1 line
2.19.1.6.gb485710b
#1 lore raw
Quoted 56 lines · Hongnan Li

From: hongnanli <[email protected]>

inode->i_mutex has been replaced with inode->i_rwsem long ago. Fix comments still mentioning i_mutex.

---
 fs/ceph/dir.c   | 6 +++---
 fs/ceph/inode.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
fs/ceph/dir.c +3 -3
index 133dbd9338e7..0cf6afe283e9 100644
@@ -145,7 +145,7 @@ __dcache_find_get_entry(struct dentry *parent, u64 idx,
 			return ERR_PTR(-EAGAIN);
 		}
 		/* reading/filling the cache are serialized by
-		   i_mutex, no need to use page lock */
+		   i_rwsem, no need to use page lock */
 		unlock_page(cache_ctl->page);
 		cache_ctl->dentries = kmap(cache_ctl->page);
 	}
@@ -155,7 +155,7 @@ __dcache_find_get_entry(struct dentry *parent, u64 idx,
 	rcu_read_lock();
 	spin_lock(&parent->d_lock);
 	/* check i_size again here, because empty directory can be
-	 * marked as complete while not holding the i_mutex. */
+	 * marked as complete while not holding the i_rwsem. */
 	if (ceph_dir_is_complete_ordered(dir) && ptr_pos < i_size_read(dir))
 		dentry = cache_ctl->dentries[cache_ctl->index];
 	else
@@ -671,7 +671,7 @@ struct dentry *ceph_handle_snapdir(struct ceph_mds_request *req,
 				   struct dentry *dentry)
 {
 	struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
-	struct inode *parent = d_inode(dentry->d_parent); /* we hold i_mutex */
+	struct inode *parent = d_inode(dentry->d_parent); /* we hold i_rwsem */
 
 	/* .snap dir? */
 	if (ceph_snap(parent) == CEPH_NOSNAP &&
fs/ceph/inode.c +1 -1
index ef4a980a7bf3..22adddb3d051 100644
@@ -1201,7 +1201,7 @@ static void update_dentry_lease_careful(struct dentry *dentry,
 
 /*
  * splice a dentry to an inode.
- * caller must hold directory i_mutex for this to be safe.
+ * caller must hold directory i_rwsem for this to be safe.
  */
 static int splice_dentry(struct dentry **pdn, struct inode *in)
 {

fs/ceph/inode.c static int fill_readdir_cache(struct inode *dir, struct dentry *dn, · line 1604

Quoted 8 lines
fs/ceph/inode.c +1 -1
@@ -1598,7 +1598,7 @@ static int fill_readdir_cache(struct inode *dir, struct dentry *dn,
 			return idx == 0 ? -ENOMEM : 0;
 		}
 		/* reading/filling the cache are serialized by
-		 * i_mutex, no need to use page lock */
+		 * i_rwsem, no need to use page lock */
 		unlock_page(ctl->page);
 		ctl->dentries = kmap(ctl->page);
 		if (idx == 0)

Merged into ceph-client/testing branch.

Thanks!

Signature · 1 line
Jeff Layton <[email protected]>