From: Jiro SEKIBA <jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org>
To: NILFS Users mailing list <users-JrjvKiOkagjYtjvyW6yDsg@public.gmane.org>
Subject: Re: nilfs_cleanerd on root partition
Date: Mon, 22 Jun 2009 10:09:15 +0900 [thread overview]
Message-ID: <87ocsh5b2c.wl%jir@sekiba.com> (raw)
In-Reply-To: <20090622.030037.34127637.ryusuke-sG5X7nlA6pw@public.gmane.org>
Hi,
At Mon, 22 Jun 2009 03:00:37 +0900 (JST),
Ryusuke Konishi wrote:
>
> On Mon, 22 Jun 2009 01:05:10 +0900 (JST), Ryusuke Konishi wrote:
> > Hi,
> > On Sun, 21 Jun 2009 17:37:08 +0300, Sami Liedes wrote:
> > > On Sun, Jun 21, 2009 at 05:02:34PM +0300, Sami Liedes wrote:
> > > > You say I should start the cleanerd by running
> > > >
> > > > # nilfs_cleanerd /dev/sdb1 /
> > > >
> > > > However nothing in the output of `nilfs_cleanerd -h' indicates
> > > > anything of the second parameter (mount point). Looking at the source,
> > > > that's how mount.nilfs2 runs it too, and that's exactly the case where
> > > > it fails.
> > >
> > > OK, I debugged a bit and figured out what the real problem is. It's
> > > the fact that nilfs_find_fs() is too strict about the mount points
> > > being the same. Namely, it considers /media/lacie and /media/lacie/ to
> > > be different mount points (it merely does a strcmp()).
> > >
> > > /proc/mounts always uses the former syntax, so if the mount command is
> > > something like `mount /dev/mapper/lacie /media/lacie/ -t nilfs2', the
> > > cleanerd is not started because mount passes "/media/lacie/" as the
> > > mount point, and nilfs_find_fs() expects it to not have the last
> > > slash.
> > >
> > > Sami
> >
> > Grr, that's an elementary and influential bug. Okay, I'll fix it.
> >
> > Sami, thank you for finding this!
> >
> > Cheers,
> > Ryusuke Konishi
>
> The following patch will fix this. I've pushed it to the git repo,
> too.
>
> Regards,
> Ryusuke Konishi
> ---
> lib/nilfs.c | 29 +++++++++++++++++++++++++----
> 1 files changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/lib/nilfs.c b/lib/nilfs.c
> index 15ee98f..9c80538 100644
> --- a/lib/nilfs.c
> +++ b/lib/nilfs.c
> @@ -147,14 +147,27 @@ static int nilfs_find_fs(struct nilfs *nilfs, const char *dev, const char *dir,
> size_t len;
> int ret, n;
> char canonical[PATH_MAX + 2];
> + char *cdev = NULL, *cdir = NULL;
>
> - if (dev && myrealpath(dev, canonical, sizeof(canonical)))
> - dev = canonical;
> + ret = -1;
> + if (dev && myrealpath(dev, canonical, sizeof(canonical))) {
> + cdev = strdup(canonical);
> + if (!cdev)
> + goto failed;
> + dev = cdev;
> + }
> +
> + if (dir && myrealpath(dir, canonical, sizeof(canonical))) {
> + cdir = strdup(canonical);
> + if (!cdir)
> + goto failed_dev;
> + dir = cdir;
> + }
>
> fp = fopen(PROCMOUNTS, "r");
> if (fp == NULL)
> - return -1;
> - ret = -1;
> + goto failed_dir;
> +
> while (fgets(line, sizeof(line), fp) != NULL) {
> n = tokenize(line, mntent, NMNTFLDS);
> assert(n == NMNTFLDS);
> @@ -181,6 +194,14 @@ static int nilfs_find_fs(struct nilfs *nilfs, const char *dev, const char *dir,
> }
> }
> fclose(fp);
> +
> + failed_dir:
> + free(cdir);
> +
> + failed_dev:
> + free(cdev);
> +
> + failed:
> return ret;
> }
>
> --
> 1.6.2
I've just pull the git repository and it just works fine for me!
thanks!
regards,
--
Jiro SEKIBA <jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org>
next prev parent reply other threads:[~2009-06-22 1:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-21 19:10 nilfs_cleanerd shutdown sh1v4_0h-/E1597aS9LQAvxtiuMwx3w
[not found] ` <280074.80083.qm-klR48C3JjEDrNpU5RS+xBlZ8N9CAUha/QQ4Iyu8u01E@public.gmane.org>
[not found] ` <20090622.030037.34127637.ryusuke-sG5X7nlA6pw@public.gmane.org>
2009-06-22 1:01 ` Jiro SEKIBA
2009-06-22 1:09 ` Jiro SEKIBA [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-11-05 17:41 nilfs_cleanerd won't run on root Andrew Benton
2009-06-20 21:19 nilfs_cleanerd on root partition James Erickson
[not found] ` <20090620211939.GA5937-SsamVeerapxB2jdCq39ADS3k8SM3+oTIrE5yTffgRl4@public.gmane.org>
2009-06-21 9:39 ` Ryusuke Konishi
[not found] ` <20090621.183937.71761103.ryusuke-sG5X7nlA6pw@public.gmane.org>
2009-06-21 13:44 ` Sami Liedes
[not found] ` <20090621134418.GA4836-7bsdmvTMBDzHOG6cAo2yLw@public.gmane.org>
2009-06-21 14:02 ` Sami Liedes
[not found] ` <20090621140234.GB4836-7bsdmvTMBDzHOG6cAo2yLw@public.gmane.org>
2009-06-21 14:37 ` Sami Liedes
[not found] ` <20090621143708.GC4836-7bsdmvTMBDzHOG6cAo2yLw@public.gmane.org>
2009-06-21 16:05 ` Ryusuke Konishi
[not found] ` <20090622.010510.133415216.ryusuke-sG5X7nlA6pw@public.gmane.org>
2009-06-21 18:00 ` Ryusuke Konishi
2009-11-06 5:41 ` nilfs_cleanerd won't run on root Jiro SEKIBA
[not found] ` <87639oqkfb.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
2009-11-06 11:43 ` Andrew Benton
2009-11-06 12:17 ` Andrew Benton
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=87ocsh5b2c.wl%jir@sekiba.com \
--to=jir-hfpbi5wx9j54eiagz67ipq@public.gmane.org \
--cc=users-JrjvKiOkagjYtjvyW6yDsg@public.gmane.org \
/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