Skip to content

Commit

Permalink
coda: allow removal of busy directories
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
jaharkes authored and Linus Torvalds committed Jul 19, 2007
1 parent d728900 commit 8c6d215
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions fs/coda/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,28 +391,23 @@ int coda_rmdir(struct inode *dir, struct dentry *de)
{
const char *name = de->d_name.name;
int len = de->d_name.len;
int error;
int error;

lock_kernel();
coda_vfs_stat.rmdir++;

if (!d_unhashed(de)) {
unlock_kernel();
return -EBUSY;
}
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 ) {
unlock_kernel();
return error;
/* fix the link count of the parent */
coda_dir_drop_nlink(dir);
coda_dir_update_mtime(dir);
}

coda_dir_drop_nlink(dir);
coda_dir_update_mtime(dir);
drop_nlink(de->d_inode);
d_delete(de);
unlock_kernel();
return 0;
return error;
}

/* rename */
Expand Down

0 comments on commit 8c6d215

Please sign in to comment.