linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Andor Daam <andor.daam@googlemail.com>
Cc: Florian Schmaus <fschmaus@gmail.com>,
	linux-mm@kvack.org, Stefan Hengelein <ilendir@googlemail.com>,
	sjenning@linux.vnet.ibm.com, Konrad Wilk <konrad.wilk@oracle.com>,
	i4passt@lists.informatik.uni-erlangen.de,
	devel@linuxdriverproject.org, Nitin Gupta <ngupta@vflare.org>
Subject: RE: (un)loadable module support for zcache
Date: Thu, 8 Mar 2012 09:07:22 -0800 (PST)	[thread overview]
Message-ID: <0e5e6a0b-2fa2-4796-bf9c-5bf693ae2477@default> (raw)
In-Reply-To: <CACQs63KgLjEPV5vdB+SamVC3CG0h2e56c60YKx3fSQ_SEwAHmg@mail.gmail.com>

> From: Andor Daam [mailto:andor.daam@googlemail.com]
> Subject: Re: (un)loadable module support for zcache
> 
> 2012/3/8 Dan Magenheimer <dan.magenheimer@oracle.com>
> >
> > > From: Florian Schmaus [mailto:fschmaus@gmail.com]
> > > Subject: Re: (un)loadable module support for zcache
> > >
> > > This should allow backends to register with cleancache and frontswap
> > > even after the mounting of filesystems and/or swapon is run. Therefore
> > > it should allow zcache to be insmodded. This would be a first step to
> > > allow rmmodding of zcache aswell.
> > >
> > > Is this approach feasible?
> >
> > Hi Stefan, Florian, and Andor --
> >
> > I do see a potential problem with this approach.  You would
> > be saving a superblock pointer and then using it later.  What
> > if the filesystem was unmounted in the meantime?  Or, worse,
> > what if it was unmounted and then the address of the superblock
> > is reused to point to some completely different object?
> >
> > I think if you ensure that cleancache_invalidate_fs() is always
> > called when a cleancache-enabled filesystem is unmounted,
> > then in cleancache_invalidate_fs() you remove the matching
> > superblock pointer from your arrays, then it should work.
> 
> We already thought of removing the matching pointer, whenever a filesystem is
> unmounted.

Great!

> As the comment to __cleancache_invalidate_fs in cleancache.c states
> that this function
> is called by any cleancache-enabled filesystem at time of unmount, we
> assumed that this function was actually always called upon unmount.

Hi Andor --

Until now, cleancache_invalidate_fs was only called for garbage
collection so it didn't really matter.  Since, after you work is
done, a missed call to cleancache_invalidate_fs has the potential
to cause data corruption, it's probably best to be paranoid
and verify.

> Is it not certain that this function is always called?

I *think* it should always be called, but I am not a filesystem expert.
It might be worth asking the question on a filesytem mailing list
(or on the individual lists for ext3/4, ocfs2, btrfs):  "Is it
ever possible for a superblock for a mounted filesystem to be free'd
without a previous call to unmount the filesystem?"  And you might
want to check the call points for cleancache_invalidate_fs (in each
of the filesystems) to see if there are error conditions which
would skip the call to cleancache_invalidate_fs.

Alternately, if you generate and keep track of a "fake pool id"
and map it (after the backend registers) to a real pool id,
I think there's no risk.  However, I agree your solution is
more elegant so as long as you verify that there is no chance
of data corruption, I am OK with your solution.

Dan

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2012-03-08 17:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CABv5NL-SquBQH8W+K1CXNBQQWqHyYO+p3Y9sPqsbfZKp5EafTg@mail.gmail.com>
2012-03-05  0:46 ` Fwd: (un)loadable module support for zcache Ilendir
2012-03-05 16:57 ` Dan Magenheimer
2012-03-08 14:36   ` Florian Schmaus
2012-03-08 15:52     ` Dan Magenheimer
2012-03-08 16:51       ` Andor Daam
2012-03-08 17:07         ` Dan Magenheimer [this message]

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=0e5e6a0b-2fa2-4796-bf9c-5bf693ae2477@default \
    --to=dan.magenheimer@oracle.com \
    --cc=andor.daam@googlemail.com \
    --cc=devel@linuxdriverproject.org \
    --cc=fschmaus@gmail.com \
    --cc=i4passt@lists.informatik.uni-erlangen.de \
    --cc=ilendir@googlemail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=ngupta@vflare.org \
    --cc=sjenning@linux.vnet.ibm.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 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).