From: Mark Fasheh <mfasheh@suse.de>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Amir Goldstein <amir73il@gmail.com>,
linux-unionfs@vger.kernel.org, Jeff Mahoney <jeffm@suse.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH 4/4] locks: map correct ino/dev pairs when exporting to userspace
Date: Wed, 1 Aug 2018 20:38:35 +0000 [thread overview]
Message-ID: <20180801203835.GE20761@wotan.suse.de> (raw)
In-Reply-To: <b5b90ff75a222ce3ace37dbd625916ae9aaa9830.camel@poochiereds.net>
Hi Jeff,
On Wed, Aug 01, 2018 at 07:03:54AM -0400, Jeff Layton wrote:
> On Tue, 2018-07-31 at 14:10 -0700, Mark Fasheh wrote:
> > /proc/locks does not always print the correct inode number/device pair.
> > Update lock_get_status() to use vfs_map_unique_ino_dev() to get the real,
> > unique values for userspace.
> >
> > Signed-off-by: Mark Fasheh <mfasheh@suse.de>
> > ---
> > fs/locks.c | 12 +++++++++---
> > 1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/locks.c b/fs/locks.c
> > index db7b6917d9c5..3a012df87fd8 100644
> > --- a/fs/locks.c
> > +++ b/fs/locks.c
> > @@ -2621,6 +2621,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
> > loff_t id, char *pfx)
> > {
> > struct inode *inode = NULL;
> > + struct dentry *dentry;
> > unsigned int fl_pid;
> > struct pid_namespace *proc_pidns = file_inode(f->file)->i_sb->s_fs_info;
> >
> > @@ -2633,8 +2634,10 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
> > if (fl_pid == 0)
> > return;
> >
> > - if (fl->fl_file != NULL)
> > + if (fl->fl_file != NULL) {
> > inode = locks_inode(fl->fl_file);
> > + dentry = file_dentry(fl->fl_file);
> > + }
> >
> > seq_printf(f, "%lld:%s ", id, pfx);
> > if (IS_POSIX(fl)) {
> > @@ -2681,10 +2684,13 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
> > : (fl->fl_type == F_WRLCK) ? "WRITE" : "READ ");
> > }
> > if (inode) {
> > + __u64 ino;
> > + dev_t dev;
> > +
> > + vfs_map_unique_ino_dev(dentry, &ino, &dev);
>
> This code is under a spinlock (blocked_locks_lock or ctx->flc_lock). I
> don't think it'll be ok to call ->getattr while holding a spinlock.
Hmm, indeed it does call under spinlock. I'll hve to rethink how to approach
this in fs/locks.c
Thanks,
--Mark
next prev parent reply other threads:[~2018-08-01 22:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 21:10 [RFC PATCH 0/4] vfs: map unique ino/dev pairs for user space Mark Fasheh
2018-07-31 21:10 ` [PATCH 1/4] vfs: introduce function to map unique ino/dev pairs Mark Fasheh
2018-07-31 23:21 ` Mark Fasheh
2018-08-01 5:41 ` Amir Goldstein
2018-08-01 15:59 ` Mark Fasheh
2018-07-31 21:10 ` [PATCH 2/4] nfs: check for NULL vfsmount in nfs_getattr Mark Fasheh
2018-07-31 22:16 ` Al Viro
2018-07-31 22:51 ` Mark Fasheh
2018-08-02 0:43 ` Al Viro
2018-08-03 2:04 ` Mark Fasheh
2018-07-31 21:10 ` [PATCH 3/4] proc: use vfs helper to get ino/dev pairs for maps file Mark Fasheh
2018-07-31 21:10 ` [PATCH 4/4] locks: map correct ino/dev pairs when exporting to userspace Mark Fasheh
2018-08-01 5:37 ` Amir Goldstein
2018-08-01 17:45 ` Mark Fasheh
2018-08-01 11:03 ` Jeff Layton
2018-08-01 20:38 ` Mark Fasheh [this message]
2018-08-02 0:24 ` [RFC PATCH 0/4] vfs: map unique ino/dev pairs for user space J. R. Okajima
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=20180801203835.GE20761@wotan.suse.de \
--to=mfasheh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=amir73il@gmail.com \
--cc=jeffm@suse.com \
--cc=jlayton@poochiereds.net \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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).