Re: [PATCH] mdadm: close parent file descriptors when starting mdmon.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 30 Aug 2011 13:30:26 +0000 "Patelczyk, Maciej"
<maciej.patelczyk@xxxxxxxxx> wrote:

> > -----Original Message-----
> > From: NeilBrown [mailto:neilb@xxxxxxx]
> > Sent: Tuesday, August 30, 2011 1:32 AM
> > To: Patelczyk, Maciej
> > Cc: linux-raid@xxxxxxxxxxxxxxx
> > Subject: Re: [PATCH] mdadm: close parent file descriptors when starting
> > mdmon.
> > 
> > On Mon, 29 Aug 2011 17:49:49 +0200 Maciej Patelczyk
> > <maciej.patelczyk@xxxxxxxxx> wrote:
> > 
> > > When mdadm is invoked by fork-and-exec it inherits all open file
> > > descriptors and when mdadm forks to exec mdmon those file descriptors
> > > are passed to mdmon. Mdmon closes only first 97 fd and that in some
> > > cases is not enough.
> > 
> > Can you describe and actual can when it is not enough?  Maybe there is
> > some
> > other problem where mdadm is not closing things as it should.
>  
> There is one:
> CIM Server (Sfcbd - Small Footprint CIM Broker) -> registered provider 
> -> intermediate library -> mdadm -> mdmon
> 
> We register provider in Sfcbd which brings some functionality to cim server.
> It uses our library which calls mdadm (popen). Later mdadm is calling mdmon
> (fork&exec).
> 
> The problem is that Sfcbd is a server and it has more than 100 files opened.
> Open files handles are passed down to mdadm (popen behavior) and here we have
> a problem.

This is a problem with Sfcbd, or with your library.  You shouldn't allow
these file descriptor to get through to mdadm.
Ideally they should all be marked 'close on exec'.
Probably the easiest though is for your library to not use popen directly but
to write your own which closes all extra fds between fork and exec.

I really do now want mdadm to have to close fds that someone else opened
(except 0,1, and 2).

NeilBrown


--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux