diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-05-14 11:12:09 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-05-14 11:12:09 +0000 |
commit | a75eeec47f39797429d5cae90db057374aeeac5d (patch) | |
tree | 103d013eb38e421a6a94b36c445dfaff31183962 /nuttx/fs/fs_umount.c | |
parent | ce1b502f81ef5c420f4d6d9fd68c31a1627cac55 (diff) | |
download | px4-nuttx-a75eeec47f39797429d5cae90db057374aeeac5d.tar.gz px4-nuttx-a75eeec47f39797429d5cae90db057374aeeac5d.tar.bz2 px4-nuttx-a75eeec47f39797429d5cae90db057374aeeac5d.zip |
umount and fat fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@227 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/fs_umount.c')
-rw-r--r-- | nuttx/fs/fs_umount.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/nuttx/fs/fs_umount.c b/nuttx/fs/fs_umount.c index b18407f20..c4abde95b 100644 --- a/nuttx/fs/fs_umount.c +++ b/nuttx/fs/fs_umount.c @@ -104,12 +104,11 @@ int umount(const char *target) /* Find the mountpt */ - inode_semtake(); mountpt_inode = inode_find(target, NULL); if (!mountpt_inode) { errcode = ENOENT; - goto errout_with_semaphore; + goto errout; } /* Verify that the inode is a mountpoint */ @@ -137,18 +136,19 @@ int umount(const char *target) * performed, or a negated error code on a failure. */ + inode_semtake(); /* Hold the semaphore through the unbind logic */ status = mountpt_inode->u.i_mops->unbind( mountpt_inode->i_private ); if (status < 0) { /* The inode is unhappy with the blkdrvr for some reason */ errcode = -status; - goto errout_with_mountpt; + goto errout_with_semaphore; } else if (status > 0) { errcode = EBUSY; - goto errout_with_mountpt; + goto errout_with_semaphore; } /* Successfully unbound */ @@ -157,17 +157,20 @@ int umount(const char *target) /* Remove the inode */ + inode_semgive(); /* Need to release for inode_release */ inode_release(mountpt_inode); + + inode_semtake(); /* Need to hold for inode_remove */ status = inode_remove(target); inode_semgive(); return status; /* A lot of goto's! But they make the error handling much simpler */ - errout_with_mountpt: - inode_release(mountpt_inode); errout_with_semaphore: inode_semgive(); + errout_with_mountpt: + inode_release(mountpt_inode); errout: *get_errno_ptr() = errcode; return ERROR; |