nilfs_cleanerd not started for mount with relative pathname
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()?
Signature · 12 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 201103021812.31515.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 25 lines · dexen deVries
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/xwith 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))
Quoted 3 lines
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 thedev' anddir' arguments withmyrealpath()?
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
Quoted 30 lines · Ryusuke Konishi
Quoted 25 lines · dexen deVries
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/xwith 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))Quoted 3 lines
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 thedev' anddir' arguments withmyrealpath()?
Quoted 5 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 nilfs_cleanerd: support relative pathnames in arguments
canonicalize pathnames of device & directory before daemonize() to support relative pathnames
--- sbin/cleanerd/cleanerd.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
sbin/cleanerd/cleanerd.c +7 -0
@@ -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 );
Signature · 6 lines
1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1299447018-19088-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH] nilfs_cleanerd: support relative pathnames in arguments
Quoted 6 lines · dexen deVries
canonicalize pathnames of device & directory before
daemonize()to support relative pathnamesSigned-off-by dexen deVries <[email protected]>--- sbin/cleanerd/cleanerd.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
Thanks.
I applied the patch with a minor amendment.
Ryusuke Konishi
Quoted 32 lines
sbin/cleanerd/cleanerd.c +7
-0@@ -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 );Signature · 6 lines
1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html