All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Miklos Szeredi <mszeredi@redhat.com>
Cc: David Howells <dhowells@redhat.com>,
	viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-nfs@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/9] VFS: Introduce a mount context
Date: Wed, 10 May 2017 09:48:51 -0400	[thread overview]
Message-ID: <1494424131.2688.17.camel@redhat.com> (raw)
In-Reply-To: <CAOssrKeyUGCbAORH0ySA2WRBn7jLmPPNEBvvvyb0xMf67KsuCg@mail.gmail.com>

On Wed, 2017-05-10 at 15:30 +0200, Miklos Szeredi wrote:
> On Wed, May 10, 2017 at 3:20 PM, Jeff Layton <jlayton@redhat.com> wrote:
> > On Wed, 2017-05-10 at 09:05 +0100, David Howells wrote:
> > > Miklos Szeredi <mszeredi@redhat.com> wrote:
> > > 
> > > > Possible rule of thumb: use it only at the place where the error
> > > > originates and not where errors are just passed on.  This would result
> > > > in at most one report per syscall, normally.
> > > > 
> > 
> > That might be hard to enforce in practice once you get into some
> > complicated layering. What if we have device_mapper setting this along
> > with filesystems too? We need clear rules here.
> 
> If the error originates in the devicemapper, then why would the
> filesystem set it?
> 
> There's always a root cause of an error and that should be where the
> detailed error is set.
> 
> Am I missing something?
> 

I was thinking that you'd need some well-defined way to tell whether the
string should be replaced. If the thing just hangs out across syscalls,
then you don't know when it got put there. Is it a leftover from a
previous syscall or did a lower layer just put it there?

But...maybe I'm making assumptions about how this would work and I
should just wait until there are patches in flight. Getting the lifetime
of these strings right will be crucial though.

> > 
> > > > And the static string thing that David implemented is also a very good
> > > > idea, IMO.
> > > 
> > > There is an issue with it: it's fine as long as you keep a ref on the module
> > > that generated it or clear all strings as part of module removal (which the
> > > mount context in this patchset does).  With the NFS mount context I did, I
> > > have to keep a ref on the NFS protocol module as well as the NFS filesystem
> > > module.
> > > 
> > > I'm tempted to make it conditionally copy the string using kvasprintf_const()
> > > - which would also permit format substitution.
> > > 
> > 
> > On balance, I think this is a reasonable way to pass back detailed
> > errors. Up until now, we've mostly relied on just printk'ing them. Now
> > though, a lot of larger machines are running containerized setups. Good
> > luck scraping dmesg for _your_ error in that situation. There may be
> > tons of mounts failing all over the place.
> > 
> > That said, I have some concerns here:
> > 
> > What's the lifetime of these strings? Do they just hang around forever
> > until the process goes away or they're replaced? If this becomes common,
> > then you could easily end up with an extra string allocation per task in
> > some cases. That could add up.
> 
> That's why I liked the static string thing.  It's just one assignment
> and no worries about freeing.  Not sure what to do about modules,
> though.  Can we somehow move the cost of checking the validity to the
> place where the error is retrieved?
> 

Seems a little dangerous, and could be limiting. Dynamically allocated
strings seem like they could be more useful.

> > 
> > One idea might be to always kfree it on syscall entry, and that might
> > mitigate the problem assuming that not everything is erroring out. Then
> > you could always do some trivial syscall to clear it manually.
> > 
> > There's also the problem of how these should be formatted. Is English ok
> > everywhere? Do we need a facility to allow translating these things?
> 
> Messages in dmesg are in English too.  If necessary userspace will do
> the translation.  I don't think the kernel would need to worry about
> that.

Fair enough. It _is_ still an improvement over dmesg, IMO.
-- 
Jeff Layton <jlayton@redhat.com>

  parent reply	other threads:[~2017-05-10 13:48 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03 16:04 [RFC][PATCH 0/9] VFS: Introduce mount context David Howells
2017-05-03 16:04 ` [PATCH 1/9] Provide a function to create a NUL-terminated string from unterminated data David Howells
2017-05-03 16:55   ` Jeff Layton
2017-05-03 19:26   ` Rasmus Villemoes
2017-05-03 20:13     ` David Howells
2017-05-03 16:04 ` [PATCH 2/9] Clean up whitespace in fs/namespace.c David Howells
2017-05-03 16:04 ` [PATCH 3/9] VFS: Introduce a mount context David Howells
2017-05-03 18:13   ` Jeff Layton
2017-05-03 18:26     ` Joe Perches
2017-05-03 18:37       ` David Howells
2017-05-03 18:43         ` Joe Perches
2017-05-03 20:11           ` David Howells
2017-05-03 20:38       ` Matthew Wilcox
2017-05-03 21:17         ` David Howells
2017-05-03 21:36         ` [Cocci] " Joe Perches
2017-05-03 21:36           ` Joe Perches
2017-05-03 21:36           ` Joe Perches
2017-05-04  6:28           ` [Cocci] " Julia Lawall
2017-05-04  6:28             ` Julia Lawall
2017-05-04  6:28             ` Julia Lawall
2017-05-04  9:27       ` David Howells
2017-05-04 14:34         ` Joe Perches
2017-05-03 21:43   ` Rasmus Villemoes
2017-05-04 10:22     ` David Howells
2017-05-08 15:05   ` Miklos Szeredi
2017-05-08 22:57     ` David Howells
2017-05-09  8:03       ` Miklos Szeredi
2017-05-09  9:32         ` David Howells
2017-05-09 11:04           ` Miklos Szeredi
2017-05-09  9:41         ` David Howells
2017-05-09 12:02           ` Miklos Szeredi
2017-05-09 18:51             ` Jeff Layton
2017-05-10  7:24               ` Miklos Szeredi
2017-05-10  8:05                 ` David Howells
2017-05-10 13:20                   ` Jeff Layton
2017-05-10 13:30                     ` Miklos Szeredi
2017-05-10 13:33                       ` Miklos Szeredi
2017-05-10 13:48                       ` Jeff Layton [this message]
2017-05-12  8:15                         ` Miklos Szeredi
2017-05-10 13:31                     ` David Howells
2017-05-10 13:37                       ` Jeff Layton
2017-05-09  9:56         ` David Howells
2017-05-09 12:38           ` Miklos Szeredi
2017-05-10 12:41         ` Karel Zak
2017-05-03 16:05 ` [PATCH 4/9] Implement fsopen() to prepare for a mount David Howells
2017-05-03 18:37   ` Jeff Layton
2017-05-03 18:41     ` David Howells
2017-05-03 20:44   ` Rasmus Villemoes
2017-05-04 12:55     ` David Howells
2017-05-04 12:58     ` David Howells
2017-05-04 10:40   ` Karel Zak
2017-05-04 13:06     ` David Howells
2017-05-04 13:34       ` Karel Zak
2017-05-09 18:40         ` Jeff Layton
2017-05-08 15:10   ` Miklos Szeredi
2017-05-08 23:09     ` David Howells
2017-05-03 16:05 ` [PATCH 5/9] Implement fsmount() to effect a pre-configured mount David Howells
2017-05-03 16:05 ` [PATCH 6/9] Sample program for driving fsopen/fsmount David Howells
2017-05-03 16:05 ` [PATCH 7/9] procfs: Move proc_fill_super() to fs/proc/root.c David Howells
2017-05-03 16:05 ` [PATCH 8/9] proc: Support the mount context in procfs David Howells
2017-05-03 16:05 ` [PATCH 9/9] NFS: Support the mount context and fsopen() David Howells
2017-05-03 16:44 ` [RFC][PATCH 0/9] VFS: Introduce mount context Jeff Layton
2017-05-03 16:50   ` David Howells
2017-05-03 17:27     ` Jeff Layton
2017-05-05 14:35 ` Miklos Szeredi
2017-05-05 15:47   ` David Howells
2017-05-08  8:25     ` Miklos Szeredi
2017-05-08  8:35     ` David Howells
2017-05-08  8:43       ` Miklos Szeredi
2017-05-08 17:03 ` Djalal Harouni
2017-05-08 17:03   ` Djalal Harouni

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=1494424131.2688.17.camel@redhat.com \
    --to=jlayton@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.