diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-11-18 17:31:04 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-11-18 17:31:04 +0000 |
commit | 698c00fd5eafaab3ddb06203ab3bf71299bf96e9 (patch) | |
tree | 6dc184ad1b96078c398d62e0dbee5ce2ba3cd84e /nuttx/fs | |
parent | 0618b39e4c2bd27666efb9e6c41781182ca32d22 (diff) | |
download | px4-nuttx-698c00fd5eafaab3ddb06203ab3bf71299bf96e9.tar.gz px4-nuttx-698c00fd5eafaab3ddb06203ab3bf71299bf96e9.tar.bz2 px4-nuttx-698c00fd5eafaab3ddb06203ab3bf71299bf96e9.zip |
Fix error in mount() error handling
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2271 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs')
-rw-r--r-- | nuttx/fs/fs_mount.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/nuttx/fs/fs_mount.c b/nuttx/fs/fs_mount.c index 22af7a136..9dcc21238 100644 --- a/nuttx/fs/fs_mount.c +++ b/nuttx/fs/fs_mount.c @@ -227,9 +227,13 @@ int mount(const char *source, const char *target, status = mops->bind(blkdrvr_inode, data, &fshandle); if (status != 0) { - /* The inode is unhappy with the blkdrvr for some reason */ + /* The inode is unhappy with the blkdrvr for some reason. Back out + * the count for the reference we failed to pass and exit with an + * error. + */ fdbg("Bind method failed: %d\n", status); + blkdrvr_inode->i_crefs--; errcode = -status; goto errout_with_mountpt; } @@ -257,6 +261,8 @@ int mount(const char *source, const char *target, /* A lot of goto's! But they make the error handling much simpler */ errout_with_mountpt: + mountpt_inode->i_crefs = 0; + inode_remove(target); inode_semgive(); inode_release(blkdrvr_inode); inode_release(mountpt_inode); |