Kumar Gala tracked down a problem with NFS mounting. This is a different fix
from his, but to the same problem.
This commit is contained in:
parent
dbd91af061
commit
fe908fda28
@ -184,6 +184,8 @@ static void delete_block_backed_filesystems(void)
|
|||||||
{
|
{
|
||||||
llist_free(fslist);
|
llist_free(fslist);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void delete_block_backed_filesystems(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLE_FEATURE_MTAB_SUPPORT
|
#if ENABLE_FEATURE_MTAB_SUPPORT
|
||||||
@ -196,12 +198,9 @@ static int fakeIt;
|
|||||||
|
|
||||||
// Perform actual mount of specific filesystem at specific location.
|
// Perform actual mount of specific filesystem at specific location.
|
||||||
|
|
||||||
static int mount_it_now(struct mntent *mp, int vfsflags)
|
static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char *filteropts = 0;
|
|
||||||
|
|
||||||
parse_mount_options(mp->mnt_opts, &filteropts);
|
|
||||||
|
|
||||||
if (fakeIt) { return 0; }
|
if (fakeIt) { return 0; }
|
||||||
|
|
||||||
@ -217,8 +216,6 @@ static int mount_it_now(struct mntent *mp, int vfsflags)
|
|||||||
vfsflags |= MS_RDONLY;
|
vfsflags |= MS_RDONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(filteropts);
|
|
||||||
|
|
||||||
// Abort entirely if permission denied.
|
// Abort entirely if permission denied.
|
||||||
|
|
||||||
if (rc && errno == EPERM)
|
if (rc && errno == EPERM)
|
||||||
@ -266,11 +263,11 @@ static int mount_it_now(struct mntent *mp, int vfsflags)
|
|||||||
static int singlemount(struct mntent *mp)
|
static int singlemount(struct mntent *mp)
|
||||||
{
|
{
|
||||||
int rc = 1, vfsflags;
|
int rc = 1, vfsflags;
|
||||||
char *loopFile = 0;
|
char *loopFile = 0, *filteropts = 0;
|
||||||
llist_t *fl = 0;
|
llist_t *fl = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
vfsflags = parse_mount_options(mp->mnt_opts, 0);
|
vfsflags = parse_mount_options(mp->mnt_opts, &filteropts);
|
||||||
|
|
||||||
// Treat fstype "auto" as unspecified.
|
// Treat fstype "auto" as unspecified.
|
||||||
|
|
||||||
@ -282,16 +279,16 @@ static int singlemount(struct mntent *mp)
|
|||||||
(!mp->mnt_type || !strcmp(mp->mnt_type,"nfs")) &&
|
(!mp->mnt_type || !strcmp(mp->mnt_type,"nfs")) &&
|
||||||
strchr(mp->mnt_fsname, ':') != NULL)
|
strchr(mp->mnt_fsname, ':') != NULL)
|
||||||
{
|
{
|
||||||
char *options=0;
|
if (nfsmount(mp->mnt_fsname, mp->mnt_dir, &vfsflags, &filteropts, 1)) {
|
||||||
parse_mount_options(mp->mnt_opts, &options);
|
|
||||||
if (nfsmount(mp->mnt_fsname, mp->mnt_dir, &vfsflags, &options, 1)) {
|
|
||||||
bb_perror_msg("nfsmount failed");
|
bb_perror_msg("nfsmount failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// Strangely enough, nfsmount() doesn't actually mount() anything.
|
// Strangely enough, nfsmount() doesn't actually mount() anything.
|
||||||
|
rc = mount_it_now(mp, vfsflags, filteropts);
|
||||||
|
if (ENABLE_FEATURE_CLEAN_UP) free(filteropts);
|
||||||
|
|
||||||
else return mount_it_now(mp, vfsflags);
|
return rc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look at the file. (Not found isn't a failure for remount.)
|
// Look at the file. (Not found isn't a failure for remount.)
|
||||||
@ -324,7 +321,7 @@ static int singlemount(struct mntent *mp)
|
|||||||
* to the actual mount. */
|
* to the actual mount. */
|
||||||
|
|
||||||
if (mp->mnt_type || (vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE)))
|
if (mp->mnt_type || (vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE)))
|
||||||
rc = mount_it_now(mp, vfsflags);
|
rc = mount_it_now(mp, vfsflags, filteropts);
|
||||||
|
|
||||||
// Loop through filesystem types until mount succeeds or we run out
|
// Loop through filesystem types until mount succeeds or we run out
|
||||||
|
|
||||||
@ -336,25 +333,26 @@ static int singlemount(struct mntent *mp)
|
|||||||
|
|
||||||
if (!fslist) {
|
if (!fslist) {
|
||||||
fslist = get_block_backed_filesystems();
|
fslist = get_block_backed_filesystems();
|
||||||
#if ENABLE_FEATURE_CLEAN_UP
|
|
||||||
if (ENABLE_FEATURE_CLEAN_UP && fslist)
|
if (ENABLE_FEATURE_CLEAN_UP && fslist)
|
||||||
atexit(delete_block_backed_filesystems);
|
atexit(delete_block_backed_filesystems);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (fl = fslist; fl; fl = fl->link) {
|
for (fl = fslist; fl; fl = fl->link) {
|
||||||
mp->mnt_type = fl->data;
|
mp->mnt_type = fl->data;
|
||||||
|
|
||||||
if (!(rc = mount_it_now(mp,vfsflags))) break;
|
if (!(rc = mount_it_now(mp,vfsflags, filteropts))) break;
|
||||||
|
|
||||||
mp->mnt_type = 0;
|
mp->mnt_type = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mount failed. Clean up
|
if (ENABLE_FEATURE_CLEAN_UP) free(filteropts);
|
||||||
|
|
||||||
|
// If mount failed, clean up loop file (if any).
|
||||||
|
|
||||||
if (rc && loopFile) {
|
if (rc && loopFile) {
|
||||||
del_loop(mp->mnt_fsname);
|
del_loop(mp->mnt_fsname);
|
||||||
if(ENABLE_FEATURE_CLEAN_UP) {
|
if (ENABLE_FEATURE_CLEAN_UP) {
|
||||||
free(loopFile);
|
free(loopFile);
|
||||||
free(mp->mnt_fsname);
|
free(mp->mnt_fsname);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user