[PVFS-developers] Manager unable to open log file

Rob Ross rross at mcs.anl.gov
Fri Jul 30 12:43:04 EDT 2004


I agree that this could be a problem.  I think that the right solution 
would probably be to open() /dev/null as you suggest and dup2() the FDs 
into the right spots.  The mgr could just blow up if it couldn't open 
/dev/null for some reason.

Regards,

Rob

On Fri, 30 Jul 2004, Stuart White wrote:

> In mgr.c, code exists that opens the log file.  (line 365 in
> 1.6.3-pre2)
> 
>    if ((logfd = open(logname, logflags, 0700)) == -1) {
> #endif
>       ERR("couldn't create logfile...continuing...\n");
>       close(0); close(1); close(2);
>    }
> 		
> If the open() of the log file fails, stdin, stdout, and stderr are
> closed, and then execution simply continues.
> 
> This seems dangerous to me.  Because stdout and stderr are closed,
> their file descriptors will be re-used when opening metadata files. 
> Lots of debugging code exists in the manager that fprintf's to stderr. 
> If stderr's file descriptor has been recycled and used for a metadata
> file, these debug fprintf's will corrupt the contents of the metadata
> files.
> 
> In my version of PVFS, I changed this case to simply error out if the
> open() of the log file failed.  However, I'm not submitting a patch for
> that because, it seems this is a judgement call for how one wants to
> handle this situation.  Another option would be to open /dev/null and
> call dup2() redirecting stdout and stderr to /dev/null.
> 
> In any case, it seems something different should be done.  I ask you
> guys to take a look at this and implement whatever correction you deem
> appropriate.
> 
> As always, feedback is appreciated!  Thanks!
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail 
> _______________________________________________
> PVFS-developers mailing list
> PVFS-developers at www.beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs-developers
> 
> 


More information about the PVFS-developers mailing list