task->fs

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

 




Isn't here a race?

linux-2.4.20-vanilla/fs/namespace.c:chroot_fs_refs():
[called from sys_pivot_root():

#        read_lock(&tasklist_lock);
#        for_each_task(p) {
#                task_lock(p);
#                fs = p->fs;
#                if (fs) {
#                        atomic_inc(&fs->count);
#                        task_unlock(p);
#                        if (fs->root==old_nd->dentry&&fs->rootmnt==old_nd->mnt)
#                                set_fs_root(fs, new_nd->mnt, new_nd->dentry);


While include/linux/fs_struct.h:set_fs_root():
[called from sys_chroot()]

#        write_lock(&fs->lock);
#        old_root = fs->root;
#        old_rootmnt = fs->rootmnt;
#        fs->rootmnt = mntget(mnt);
#        fs->root = dget(dentry);

Shouldn't chroot_fs_refs() read_lock() fs->lock? What if p is in
the middle of a chroot() on another CPU while we trying to pivot_root()?

bit,
adam

--
1024D/37B8D989 954B 998A E5F5 BA2A 3622  82DD 54C2 843D 37B8 D989      
finger://borso@vekoll.vein.hu | Some days, my soul's confined
http://www.keyserver.net | And out of mind
Sleep forever
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux