All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Shiyang Ruan <ruansy.fnst@fujitsu.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	Linux NVDIMM <nvdimm@lists.linux.dev>,
	Linux MM <linux-mm@kvack.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	Jane Chu <jane.chu@oracle.com>
Subject: Re: [PATCH v12 6/7] xfs: Implement ->notify_failure() for XFS
Date: Wed, 13 Apr 2022 16:09:46 +1000	[thread overview]
Message-ID: <20220413060946.GL1544202@dread.disaster.area> (raw)
In-Reply-To: <CAPcyv4jKLZhcCiSEU+O+OJ2e+y9_B2CvaEfAKyBnhhSd+da=Zg@mail.gmail.com>

On Tue, Apr 12, 2022 at 07:06:40PM -0700, Dan Williams wrote:
> On Tue, Apr 12, 2022 at 5:04 PM Dave Chinner <david@fromorbit.com> wrote:
> > On Mon, Apr 11, 2022 at 12:09:03AM +0800, Shiyang Ruan wrote:
> > > Introduce xfs_notify_failure.c to handle failure related works, such as
> > > implement ->notify_failure(), register/unregister dax holder in xfs, and
> > > so on.
> > >
> > > If the rmap feature of XFS enabled, we can query it to find files and
> > > metadata which are associated with the corrupt data.  For now all we do
> > > is kill processes with that file mapped into their address spaces, but
> > > future patches could actually do something about corrupt metadata.
> > >
> > > After that, the memory failure needs to notify the processes who are
> > > using those files.
...
> > > @@ -1964,8 +1965,8 @@ xfs_alloc_buftarg(
> > >       btp->bt_mount = mp;
> > >       btp->bt_dev =  bdev->bd_dev;
> > >       btp->bt_bdev = bdev;
> > > -     btp->bt_daxdev = fs_dax_get_by_bdev(bdev, &btp->bt_dax_part_off, NULL,
> > > -                                         NULL);
> > > +     btp->bt_daxdev = fs_dax_get_by_bdev(bdev, &btp->bt_dax_part_off, mp,
> > > +                                         &xfs_dax_holder_operations);
> >
> > I see a problem with this: we are setting up notify callbacks before
> > we've even read in the superblock during mount. i.e. we don't even
> > kow yet if we've got an XFS filesystem on this block device.
> > Hence these notifications need to be delayed until after the
> > filesystem is mounted, all the internal structures have been set up
> > and log recovery has completed.
> 
> So I think this gets back to the fact that there will eventually be 2
> paths into this notifier.

I'm not really concerned by how the notifications are generated;
my concern is purely that notifications can be handled safely.

> All that to say, I think it is ok / expected for the filesystem to
> drop notifications on the floor when it is not ready to handle them.

Well, yes. The whole point of notifications is the consumer makes
the decision on what to do with the notification it receives - the
producer of the notification does not (and can not) dictate what
policy the consumer(s) implement...

> For example there are no processes to send SIGBUS to if the filesystem
> has not even finished mount.

There may be not processes to send SIGBUS to even if the filesystem
has finished mount. But we still want the notifications to be
delivered and we still need to handle them safely.

IOWs, while we might start by avoiding notifications during mount,
this doesn't mean we will never have reason to process events during
mount. What we do with this notification is going to evolve over
time as we add new and adapt existing functionality....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2022-04-13  6:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-10 16:08 [PATCH v12 0/7] fsdax: introduce fs query to support reflink Shiyang Ruan
2022-04-10 16:08 ` [PATCH v12 1/7] dax: Introduce holder for dax_device Shiyang Ruan
2022-04-11  6:35   ` Christoph Hellwig
2022-04-12 23:22   ` Dan Williams
2022-04-10 16:08 ` [PATCH v12 2/7] mm: factor helpers for memory_failure_dev_pagemap Shiyang Ruan
2022-04-10 19:48   ` kernel test robot
2022-04-10 20:19   ` kernel test robot
2022-04-11  6:37   ` Christoph Hellwig
2022-04-11  9:39     ` Shiyang Ruan
2022-04-10 16:09 ` [PATCH v12 3/7] pagemap,pmem: Introduce ->memory_failure() Shiyang Ruan
2022-04-10 16:09 ` [PATCH v12 4/7] fsdax: Introduce dax_lock_mapping_entry() Shiyang Ruan
2022-04-10 16:09 ` [PATCH v12 5/7] mm: Introduce mf_dax_kill_procs() for fsdax case Shiyang Ruan
2022-04-11  6:40   ` wangjianjian (C)
2022-04-11  9:40     ` Shiyang Ruan
2022-04-10 16:09 ` [PATCH v12 6/7] xfs: Implement ->notify_failure() for XFS Shiyang Ruan
2022-04-10 18:58   ` kernel test robot
2022-04-10 23:54   ` kernel test robot
2022-04-11  6:39   ` Christoph Hellwig
2022-04-13  0:04   ` Dave Chinner
2022-04-13  2:06     ` Dan Williams
2022-04-13  6:09       ` Dave Chinner [this message]
2022-04-13 17:09         ` Dan Williams
2022-04-13 17:12           ` Christoph Hellwig
2022-04-14 13:22   ` [xfs] bf68be0c39: BUG:KASAN:null-ptr-deref_in_fs_put_dax kernel test robot
2022-04-14 13:22     ` kernel test robot
2022-04-10 16:09 ` [PATCH v12 7/7] fsdax: set a CoW flag when associate reflink mappings Shiyang Ruan
2022-04-11  6:55   ` Christoph Hellwig

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=20220413060946.GL1544202@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=dan.j.williams@intel.com \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=jane.chu@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=ruansy.fnst@fujitsu.com \
    /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.