coda: allow removal of busy directories
A directory without children may still be busy when it is the cwd for some process. We can safely remove such a directory because the VFS prevents further operations. Also we don't need to call d_delete as it is already called in vfs_rmdir. Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
d728900cd5
commit
8c6d215284
@@ -396,23 +396,18 @@ int coda_rmdir(struct inode *dir, struct dentry *de)
|
|||||||
lock_kernel();
|
lock_kernel();
|
||||||
coda_vfs_stat.rmdir++;
|
coda_vfs_stat.rmdir++;
|
||||||
|
|
||||||
if (!d_unhashed(de)) {
|
|
||||||
unlock_kernel();
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len);
|
error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len);
|
||||||
|
if (!error) {
|
||||||
|
/* VFS may delete the child */
|
||||||
|
if (de->d_inode)
|
||||||
|
de->d_inode->i_nlink = 0;
|
||||||
|
|
||||||
if ( error ) {
|
/* fix the link count of the parent */
|
||||||
unlock_kernel();
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
coda_dir_drop_nlink(dir);
|
coda_dir_drop_nlink(dir);
|
||||||
coda_dir_update_mtime(dir);
|
coda_dir_update_mtime(dir);
|
||||||
drop_nlink(de->d_inode);
|
}
|
||||||
d_delete(de);
|
|
||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
return 0;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rename */
|
/* rename */
|
||||||
|
Reference in New Issue
Block a user