[ofa-general] Re: [PATCH] opensm: chdir to / in the daemon mode
Sasha Khapyorsky
sashak at voltaire.com
Sun Mar 25 08:50:11 PDT 2007
On 10:39 Sun 25 Mar , Hal Rosenstock wrote:
> On Sun, 2007-03-25 at 08:17, Michael S. Tsirkin wrote:
> > > Quoting Hal Rosenstock <halr at voltaire.com>:
> > > Subject: Re: [ofa-general] Re: [PATCH] opensm: chdir to / in the daemon mode
> > >
> > > On Sun, 2007-03-25 at 07:06, Michael S. Tsirkin wrote:
> > > > > Quoting Sasha Khapyorsky <sashak at voltaire.com>:
> > > > > Subject: Re: [PATCH] opensm: chdir to / in the daemon mode
> > > > >
> > > > > On 13:02 Sun 25 Mar , Yevgeny Kliteynik wrote:
> > > > > > Sasha Khapyorsky wrote:
> > > > > > >Change working directory to "/" when running in the daemon mode. It is
> > > > > > >in order to not keep the filesystem busy and prevent potential umount
> > > > > > >failures.
> > > > > > >
> > > > > > >Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> > > > > > >---
> > > > > > > osm/opensm/main.c | 2 ++
> > > > > > > 1 files changed, 2 insertions(+), 0 deletions(-)
> > > > > > >
> > > > > > >diff --git a/osm/opensm/main.c b/osm/opensm/main.c
> > > > > > >index 3f465e9..d5c3699 100644
> > > > > > >--- a/osm/opensm/main.c
> > > > > > >+++ b/osm/opensm/main.c
> > > > > > >@@ -548,6 +548,8 @@ static int daemonize(osm_opensm_t *osm)
> > > > > > > } else if (pid > 0)
> > > > > > > exit(0);
> > > > > > >
> > > > > > >+ chdir("/");
> > > > > >
> > > > > > What if there is a coredump?
> > > > >
> > > > > This will go at "/".
> > > > >
> > > > > > Wouldn't it be better to chdir
> > > > > > to /tmp/ instead ?
> > > > >
> > > > > /tmp can be mounted fs as well.
> > > > >
> > > > > Sasha
> > > >
> > > > So can / IMO.
> > > > Isn't this a user error?
> > > > Shouldn't we let the user decide where to run it?
> > >
> > > How about using OSM_DEFAULT_TMP_DIR for this ? We're putting other dumps
> > > there (like osm.fdbs, osm.mcfdbs, osm-subnet.lst, etc.).
> >
> > Or the log directory?
>
> That is the default dierctory for the log file too.
>
> #define OSM_DEFAULT_TMP_DIR "/var/log/"
> #define OSM_DEFAULT_LOG_FILE "/var/log/osm.log"
Yes, but log and/or tmp directory has different purpose which doesn't
serve the patch goal.
Sasha
More information about the general
mailing list