[PVFS-developers]
Minor pvfs-1.6.3 pre1 patch (don't close stdout in do_restart)
White Stuart - stwhit
Stuart.White at acxiom.com
Mon May 3 11:56:13 EDT 2004
In the iod during startup, the code opens the logfile, and then calls dup2()
on stdout and stderr, so that anything printed to stdout or stderr will get
printed to the log file:
if ((fd = open(logfile, logflags, 0700)) == -1) return -1;
#endif
fchmod(fd, 0755);
dup2(fd, 2);
dup2(fd, 1);
Later, in do_restart(), which gets called when the manager gets bounced, the
IOD closes all open file descriptors, except for the "accept" socket and
stderr. It closes stdout.
for (i=0; i < sysconf(_SC_OPEN_MAX); i++) {
if (i != acc && i != 2) close(i);
}
So, stdout (fd 1) will get reused later when opening local data files. If a
developer puts some debug code into the IOD which calls printf(), it works
properly until the manager gets bounced, at which point the printf's start
getting printed to one of the data files! You can imagine my surprise when
my data files started getting corrupted by my debug printf's! :-)
I have attached a patch that simply adds file descriptor 1 to the list of
"special" file descriptors that do not get closed in do_restart().
Thanks!
Stuart White
**********************************************************************
The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged.
If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly
prohibited.
If you have received this communication in error,
please re-send this communication to the sender and
delete the original message or any copy of it from your
computer system. Thank You.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pvfs-iod-restart.patch
Type: application/octet-stream
Size: 444 bytes
Desc: not available
Url : http://www.beowulf-underground.org/pipermail/pvfs-developers/attachments/20040503/7c2df9df/pvfs-iod-restart.obj
More information about the PVFS-developers
mailing list