lkml.org 
[lkml]   [2003]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] sysfs_remove_dir Vs dcache_readdir race fix
    On Thu, Nov 20, 2003 at 07:17:09AM -0800, Andrew Morton wrote:
    > Maneesh Soni <maneesh@in.ibm.com> wrote:
    > > cpu 0 cpu 1
    > > dcache_dir_open()
    > > --> adds the cursor dentry
    > >
    > > sysfs_remove_dir()
    > > --> list_del_init cursor dentry
    > >
    > > dcache_readdir()
    > > --> loops forever on inititalized cursor dentry.
    > >
    > >
    > > Though all these operations happen under parent's i_sem, but it is dropped
    > > between ->open() and ->readdir() as both are different calls.
    > >
    > > I think people will also agree that there is no need for sysfs_remove_dir()
    > > to modify d_subdirs list.
    >
    > Seems to me that the libfs code is fragile.
    >
    > What happens if the dentry at filp->f_private_data gets moved to a
    > different directory after someone did dcache_dir_open()? Does the loop
    > in dcache_readdir() go infinite again?

    I am not sure if it is that bad. AFAICS, private_data points to a dummy
    dentry marking the current directory read position, that dentry cannot
    be moved to a different directory.

    Thanks
    Dipankar
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:58    [W:0.026 / U:90.372 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site