* nilfs_cleanerd not started for mount with relative pathname
@ 2011-03-02 17:12 dexen deVries
[not found] ` <201103021812.31515.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: dexen deVries @ 2011-03-02 17:12 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
Hi,
when testing my other patches, the following came up:
with absolute pathname:
# mount /dev/sdb2 /mnt/x
# ps ax | grep [n]ilfs_cleanerd
30408 ? Ss 0:00 /sbin/nilfs_cleanerd -n /dev/sdb2 /mnt/x
with relative mountpoint pathname:
# umount /mnt/x
# cd /mnt
# mount /dev/sdb2 x
# ps ax | grep [n]ilfs_cleanerd
((no such process))
with relative device pathname:
# umount /mnt/x
# cd /dev
# mount sdb2 /mnt/x
# ps ax | grep [n]ilfs_cleanerd
((no such process))
This is due to chdir(ROOTDIR) in daemonize(); currently daemonize is always
called with nochdir == 0. Should I hardcode it to nochdir == 1 or canonicalize
the `dev' and `dir' arguments with myrealpath()?
--
dexen deVries
[[[↓][→]]]
47. As Will Rogers would have said, "There is no such thing as a free
variable."
(Alan Perlis, `Epigrams on Programming')
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nilfs_cleanerd not started for mount with relative pathname
[not found] ` <201103021812.31515.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2011-03-03 17:32 ` Ryusuke Konishi
[not found] ` <20110304.023204.179943022.ryusuke-sG5X7nlA6pw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Ryusuke Konishi @ 2011-03-03 17:32 UTC (permalink / raw)
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
On Wed, 2 Mar 2011 18:12:31 +0100, dexen deVries wrote:
> Hi,
>
>
> when testing my other patches, the following came up:
>
> with absolute pathname:
> # mount /dev/sdb2 /mnt/x
> # ps ax | grep [n]ilfs_cleanerd
> 30408 ? Ss 0:00 /sbin/nilfs_cleanerd -n /dev/sdb2 /mnt/x
>
>
> with relative mountpoint pathname:
> # umount /mnt/x
> # cd /mnt
> # mount /dev/sdb2 x
> # ps ax | grep [n]ilfs_cleanerd
> ((no such process))
>
> with relative device pathname:
> # umount /mnt/x
> # cd /dev
> # mount sdb2 /mnt/x
> # ps ax | grep [n]ilfs_cleanerd
> ((no such process))
>
> This is due to chdir(ROOTDIR) in daemonize(); currently daemonize is always
> called with nochdir == 0. Should I hardcode it to nochdir == 1 or canonicalize
> the `dev' and `dir' arguments with myrealpath()?
It sounds like cleanerd needs a fix.
I'll take a look and answer to you tomorrow.
Thanks,
Ryusuke Konishi
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nilfs_cleanerd not started for mount with relative pathname
[not found] ` <20110304.023204.179943022.ryusuke-sG5X7nlA6pw@public.gmane.org>
@ 2011-03-04 3:06 ` Ryusuke Konishi
[not found] ` <20110304.120604.248913114.ryusuke-sG5X7nlA6pw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Ryusuke Konishi @ 2011-03-04 3:06 UTC (permalink / raw)
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
Hi,
On Fri, 04 Mar 2011 02:32:04 +0900 (JST), Ryusuke Konishi wrote:
> On Wed, 2 Mar 2011 18:12:31 +0100, dexen deVries wrote:
> > Hi,
> >
> >
> > when testing my other patches, the following came up:
> >
> > with absolute pathname:
> > # mount /dev/sdb2 /mnt/x
> > # ps ax | grep [n]ilfs_cleanerd
> > 30408 ? Ss 0:00 /sbin/nilfs_cleanerd -n /dev/sdb2 /mnt/x
> >
> >
> > with relative mountpoint pathname:
> > # umount /mnt/x
> > # cd /mnt
> > # mount /dev/sdb2 x
> > # ps ax | grep [n]ilfs_cleanerd
> > ((no such process))
> >
> > with relative device pathname:
> > # umount /mnt/x
> > # cd /dev
> > # mount sdb2 /mnt/x
> > # ps ax | grep [n]ilfs_cleanerd
> > ((no such process))
> >
> > This is due to chdir(ROOTDIR) in daemonize(); currently daemonize is always
> > called with nochdir == 0. Should I hardcode it to nochdir == 1 or canonicalize
> > the `dev' and `dir' arguments with myrealpath()?
>
> It sounds like cleanerd needs a fix.
> I'll take a look and answer to you tomorrow.
>
> Thanks,
> Ryusuke Konishi
This was actually a cleanerd bug. (Good catch)
Cleanerd should canonicalize the dev and dir arguments before calling
the daemonize function as you pointed out.
Would you like to have a go at this ?
Thanks,
Ryusuke Konishi
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] nilfs_cleanerd: support relative pathnames in arguments
[not found] ` <20110304.120604.248913114.ryusuke-sG5X7nlA6pw@public.gmane.org>
@ 2011-03-06 21:30 ` dexen deVries
[not found] ` <1299447018-19088-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: dexen deVries @ 2011-03-06 21:30 UTC (permalink / raw)
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
canonicalize pathnames of device & directory before daemonize() to support relative pathnames
Signed-off-by: dexen deVries <dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
sbin/cleanerd/cleanerd.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/sbin/cleanerd/cleanerd.c b/sbin/cleanerd/cleanerd.c
index 1f03cfb..3d58916 100644
--- a/sbin/cleanerd/cleanerd.c
+++ b/sbin/cleanerd/cleanerd.c
@@ -1343,6 +1343,7 @@ static int nilfs_cleanerd_clean_loop(struct nilfs_cleanerd *cleanerd)
int main(int argc, char *argv[])
{
char *progname, *conffile;
+ char canonical[PATH_MAX + 2];
const char *dev, *dir;
char *endptr;
int status, nofork, c;
@@ -1406,6 +1407,12 @@ int main(int argc, char *argv[])
if (optind < argc)
dir = argv[optind++];
+ if (dev && myrealpath(dev, canonical, sizeof(canonical)))
+ dev = strdup(canonical);
+
+ if (dir && myrealpath(dir, canonical, sizeof(canonical)))
+ dir = strdup(canonical);
+
if (daemonize(0, 0, nofork) < 0) {
fprintf(stderr, "%s: %s\n", progname, strerror(errno));
exit(1);
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] nilfs_cleanerd: support relative pathnames in arguments
[not found] ` <1299447018-19088-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2011-03-07 2:32 ` Ryusuke Konishi
0 siblings, 0 replies; 5+ messages in thread
From: Ryusuke Konishi @ 2011-03-07 2:32 UTC (permalink / raw)
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
On Sun, 6 Mar 2011 22:30:18 +0100, dexen deVries wrote:
> canonicalize pathnames of device & directory before daemonize() to support relative pathnames
>
> Signed-off-by: dexen deVries <dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> sbin/cleanerd/cleanerd.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
Thanks.
I applied the patch with a minor amendment.
Ryusuke Konishi
> diff --git a/sbin/cleanerd/cleanerd.c b/sbin/cleanerd/cleanerd.c
> index 1f03cfb..3d58916 100644
> --- a/sbin/cleanerd/cleanerd.c
> +++ b/sbin/cleanerd/cleanerd.c
> @@ -1343,6 +1343,7 @@ static int nilfs_cleanerd_clean_loop(struct nilfs_cleanerd *cleanerd)
> int main(int argc, char *argv[])
> {
> char *progname, *conffile;
> + char canonical[PATH_MAX + 2];
> const char *dev, *dir;
> char *endptr;
> int status, nofork, c;
> @@ -1406,6 +1407,12 @@ int main(int argc, char *argv[])
> if (optind < argc)
> dir = argv[optind++];
>
> + if (dev && myrealpath(dev, canonical, sizeof(canonical)))
> + dev = strdup(canonical);
> +
> + if (dir && myrealpath(dir, canonical, sizeof(canonical)))
> + dir = strdup(canonical);
> +
> if (daemonize(0, 0, nofork) < 0) {
> fprintf(stderr, "%s: %s\n", progname, strerror(errno));
> exit(1);
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-03-07 2:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 17:12 nilfs_cleanerd not started for mount with relative pathname dexen deVries
[not found] ` <201103021812.31515.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-03 17:32 ` Ryusuke Konishi
[not found] ` <20110304.023204.179943022.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-03-04 3:06 ` Ryusuke Konishi
[not found] ` <20110304.120604.248913114.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-03-06 21:30 ` [PATCH] nilfs_cleanerd: support relative pathnames in arguments dexen deVries
[not found] ` <1299447018-19088-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-07 2:32 ` Ryusuke Konishi
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).