Backport failing umount attempt fix from trunk

This commit is contained in:
Thomas Veerman 2010-09-17 11:07:18 +00:00
parent 954d729e75
commit 4e706a260a
2 changed files with 28 additions and 16 deletions

View File

@ -74,10 +74,13 @@ PUBLIC int fs_link()
} }
/* Temporarily open the last dir */ /* Temporarily open the last dir */
if( (ip = get_inode(fs_dev, fs_m_in.REQ_DIR_INO)) == NULL) if( (ip = get_inode(fs_dev, fs_m_in.REQ_DIR_INO)) == NULL) {
return(EINVAL); put_inode(rip);
return(EINVAL);
}
if (ip->i_links_count == NO_LINK) { /* Dir does not actually exist */ if (ip->i_links_count == NO_LINK) { /* Dir does not actually exist */
put_inode(rip);
put_inode(ip); put_inode(ip);
return(ENOENT); return(ENOENT);
} }
@ -347,6 +350,7 @@ PUBLIC int fs_rename()
if (r == EENTERMOUNT || r == ELEAVEMOUNT) { if (r == EENTERMOUNT || r == ELEAVEMOUNT) {
put_inode(old_ip); put_inode(old_ip);
old_ip = NULL;
if (r == EENTERMOUNT) r = EXDEV; /* should this fail at all? */ if (r == EENTERMOUNT) r = EXDEV; /* should this fail at all? */
else if (r == ELEAVEMOUNT) r = EINVAL; /* rename on dot-dot */ else if (r == ELEAVEMOUNT) r = EINVAL; /* rename on dot-dot */
} }
@ -354,12 +358,13 @@ PUBLIC int fs_rename()
/* Get new dir inode */ /* Get new dir inode */
if( (new_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL) if( (new_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL)
r = err_code; r = err_code;
else {
if (new_dirp->i_links_count == NO_LINK) { /* Dir does not actually exist */ if (new_dirp->i_links_count == NO_LINK) { /* Dir does not actually exist */
put_inode(old_ip); put_inode(old_ip);
put_inode(old_dirp); put_inode(old_dirp);
put_inode(new_dirp); put_inode(new_dirp);
return(ENOENT); return(ENOENT);
}
} }
new_ip = advance(new_dirp, new_name, IGN_PERM); /* not required to exist */ new_ip = advance(new_dirp, new_name, IGN_PERM); /* not required to exist */
@ -368,6 +373,7 @@ PUBLIC int fs_rename()
* Note that ELEAVEMOUNT is covered by the dot-dot check later. */ * Note that ELEAVEMOUNT is covered by the dot-dot check later. */
if(err_code == EENTERMOUNT) { if(err_code == EENTERMOUNT) {
put_inode(new_ip); put_inode(new_ip);
new_ip = NULL;
r = EBUSY; r = EBUSY;
} }

View File

@ -68,10 +68,13 @@ PUBLIC int fs_link()
} }
/* Temporarily open the last dir */ /* Temporarily open the last dir */
if( (ip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_DIR_INO)) == NULL) if( (ip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_DIR_INO)) == NULL) {
return(EINVAL); put_inode(rip);
return(EINVAL);
}
if (ip->i_nlinks == NO_LINK) { /* Dir does not actually exist */ if (ip->i_nlinks == NO_LINK) { /* Dir does not actually exist */
put_inode(rip);
put_inode(ip); put_inode(ip);
return(ENOENT); return(ENOENT);
} }
@ -315,6 +318,7 @@ PUBLIC int fs_rename()
if (r == EENTERMOUNT || r == ELEAVEMOUNT) { if (r == EENTERMOUNT || r == ELEAVEMOUNT) {
put_inode(old_ip); put_inode(old_ip);
old_ip = NULL;
if (r == EENTERMOUNT) r = EXDEV; /* should this fail at all? */ if (r == EENTERMOUNT) r = EXDEV; /* should this fail at all? */
else if (r == ELEAVEMOUNT) r = EINVAL; /* rename on dot-dot */ else if (r == ELEAVEMOUNT) r = EINVAL; /* rename on dot-dot */
} }
@ -322,12 +326,13 @@ PUBLIC int fs_rename()
/* Get new dir inode */ /* Get new dir inode */
if( (new_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL) if( (new_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL)
r = err_code; r = err_code;
else {
if (new_dirp->i_nlinks == NO_LINK) { /* Dir does not actually exist */ if (new_dirp->i_nlinks == NO_LINK) { /* Dir does not actually exist */
put_inode(old_ip); put_inode(old_ip);
put_inode(old_dirp); put_inode(old_dirp);
put_inode(new_dirp); put_inode(new_dirp);
return(ENOENT); return(ENOENT);
}
} }
new_ip = advance(new_dirp, new_name, IGN_PERM); /* not required to exist */ new_ip = advance(new_dirp, new_name, IGN_PERM); /* not required to exist */
@ -336,6 +341,7 @@ PUBLIC int fs_rename()
* Note that ELEAVEMOUNT is covered by the dot-dot check later. */ * Note that ELEAVEMOUNT is covered by the dot-dot check later. */
if(err_code == EENTERMOUNT) { if(err_code == EENTERMOUNT) {
put_inode(new_ip); put_inode(new_ip);
new_ip = NULL;
r = EBUSY; r = EBUSY;
} }