Re: Re: FW: who create files under /dev/

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

 



> -----Original Messages-----
> From: wuzhouhui <wuzhouhui14@xxxxxxxxxxxxxxxx>
> Sent Time: 2018-04-11 22:03:39 (Wednesday)
> To: "Robert Wolfe" <robert.wolfe@xxxxxxxxxxxxxxx>, linux-newbie@xxxxxxxxxxxxxxx
> Cc: 
> Subject: Re: FW: who create files under /dev/
> 
> I encountered an issue when developing md. When I using "mdadm -S 
> dev/md0" to destroy md device, the data structure (such as gendisk, 
> request_queue, kobject and mkdev_s) in kernel are destroyed but /dev/md0 
> remained. So I want to know who is responsible to remove /dev/md0.

Finally, I found the reason. Generally, the device file under /dev/ is created
by kernel thread kdevtmpfs. When device driver request kdevtmpfs to delete
a device file (by del_gendisk()), the kdevtmpfs will not delete it if this device
file is not created by itself (see handle_remove() in linux/drivers/base/devtmpfs.c).

In CentOS 7, I use old mdadm to create md device. In this version of mdadm, the codes
that check udev availability have bugs in CentOS 7, this upstream commit fix it:
5ffdc2dd443d (Update test for "is udev active"). When mdadm found udev is not available,
it will create /dev/md0 by itself, but it will not delete /dev/md0 when stop md device.

Thank for everyone!

> 
> On 04/11/2018 09:56 PM, Robert Wolfe wrote:
> > From: Robert Wolfe [mailto:robert.wolfe@xxxxxxxxxxxxxxx]
> > Sent: Wednesday, April 11, 2018 8:53 AM
> > To: 'wuzhouhui' <wuzhouhui14@xxxxxxxxxxxxxxxx>;
> > 'linux-newbie@xxxxxxxxxxxxxxx' <linux-newbie@xxxxxxxxxxxxxxx>
> > Subject: RE: who create files under /dev/
> > 
> > These are usually created during the OS installation.  The best way I would
> > think to find this out is to do an ‘ls –lrt’ on the files in the /dev
> > directory to see what user the directories were created by.  Although, I am
> > not quite sure why you would want to know this?
> > 
> > From: linux-newbie-owner@xxxxxxxxxxxxxxx
> > [mailto:linux-newbie-owner@xxxxxxxxxxxxxxx] On Behalf Of wuzhouhui
> > Sent: Wednesday, April 11, 2018 4:48 AM
> > To: linux-newbie@xxxxxxxxxxxxxxx
> > Subject: Re: who create files under /dev/
> > 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
��.n��������+%������w��{.n�����{��w�n'��{ay�ʇڙ���f���h������_�(�階�ݢj"��������G����?���&���iO����v��m������)�^j����?}��




[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux