linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: miklos@szeredi.hu, ktkhai@virtuozzo.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/6] fuse: Protect fuse_inode::nlookup with fuse_inode::lock
Date: Tue, 06 Nov 2018 12:44:03 +0300	[thread overview]
Message-ID: <154149744356.18189.13444618369955494886.stgit@localhost.localdomain> (raw)
In-Reply-To: <154149673368.18189.14752124997476502777.stgit@localhost.localdomain>

This continues previous patch and introduces the same
protection for nlookup field. It goes as separate patch
since it's separate logic change (sadly, but it looks
impossible to split previous patch more then in this way).

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/fuse/dir.c     |    4 ++--
 fs/fuse/inode.c   |    4 ++--
 fs/fuse/readdir.c |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 35f3b3d1e044..ac8519285327 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -222,9 +222,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
 				fuse_queue_forget(fc, forget, outarg.nodeid, 1);
 				goto invalid;
 			}
-			spin_lock(&fc->lock);
+			spin_lock(&fi->lock);
 			fi->nlookup++;
-			spin_unlock(&fc->lock);
+			spin_unlock(&fi->lock);
 		}
 		kfree(forget);
 		if (ret == -ENOMEM)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 5f488b019cd9..b8092d49a4b2 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -327,9 +327,9 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
 	}
 
 	fi = get_fuse_inode(inode);
-	spin_lock(&fc->lock);
+	spin_lock(&fi->lock);
 	fi->nlookup++;
-	spin_unlock(&fc->lock);
+	spin_unlock(&fi->lock);
 	fuse_change_attributes(inode, attr, attr_valid, attr_version);
 
 	return inode;
diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c
index ab18b78f4755..574d03f8a573 100644
--- a/fs/fuse/readdir.c
+++ b/fs/fuse/readdir.c
@@ -213,9 +213,9 @@ static int fuse_direntplus_link(struct file *file,
 		}
 
 		fi = get_fuse_inode(inode);
-		spin_lock(&fc->lock);
+		spin_lock(&fi->lock);
 		fi->nlookup++;
-		spin_unlock(&fc->lock);
+		spin_unlock(&fi->lock);
 
 		forget_all_cached_acls(inode);
 		fuse_change_attributes(inode, &o->attr,

  parent reply	other threads:[~2018-11-06 19:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06  9:43 [PATCH 0/6] fuse: Further reducing contention of fc->lock Kirill Tkhai
2018-11-06  9:43 ` [PATCH 1/6] fuse: Change argument of fuse_flush_writepages() Kirill Tkhai
2018-11-07 14:00   ` Miklos Szeredi
2018-11-06  9:43 ` [PATCH 2/6] fuse: Add fuse_inode argument to fuse_prepare_release() Kirill Tkhai
2018-11-06  9:43 ` [PATCH 3/6] fuse: Introduce fuse_inode::lock to protect write related fields and statistics Kirill Tkhai
2018-11-06  9:43 ` [PATCH 4/6] fuse: Implement fuse_attr_version_inc() Kirill Tkhai
2018-11-07 14:12   ` Miklos Szeredi
2018-11-06  9:44 ` Kirill Tkhai [this message]
2018-11-07 14:20   ` [PATCH 5/6] fuse: Protect fuse_inode::nlookup with fuse_inode::lock Miklos Szeredi
2018-11-06  9:44 ` [PATCH 6/6] fuse: Protect fuse_file::reserved_req via corresponding fuse_inode::lock Kirill Tkhai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=154149744356.18189.13444618369955494886.stgit@localhost.localdomain \
    --to=ktkhai@virtuozzo.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).