Logged falling back to mounting read-only
When the ntfs image is unclean, usually because it was not unmounted properly from Windows, mounting read-write is denied and falls back to read-only. Log this situation in the syslog, so that users mounting through /etc/fstab can more easily know what is going on. Also remove the "rw" option if it was stated.pull/2/head
parent
45ba639781
commit
4128e9da58
|
@ -4449,10 +4449,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* Force read-only mount if the device was found read-only */
|
||||
if (!ctx->ro && NVolReadOnly(ctx->vol)) {
|
||||
ctx->rw = FALSE;
|
||||
ctx->ro = TRUE;
|
||||
if (ntfs_strinsert(&parsed_options, ",ro"))
|
||||
goto err_out;
|
||||
}
|
||||
ntfs_log_info("Could not mount read-write, trying read-only\n");
|
||||
} else
|
||||
if (ctx->rw && ntfs_strinsert(&parsed_options, ",rw"))
|
||||
goto err_out;
|
||||
/* We must do this after ntfs_open() to be able to set the blksize */
|
||||
if (ctx->blkdev && set_fuseblk_options(&parsed_options))
|
||||
goto err_out;
|
||||
|
|
|
@ -4212,10 +4212,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* Force read-only mount if the device was found read-only */
|
||||
if (!ctx->ro && NVolReadOnly(ctx->vol)) {
|
||||
ctx->rw = FALSE;
|
||||
ctx->ro = TRUE;
|
||||
if (ntfs_strinsert(&parsed_options, ",ro"))
|
||||
goto err_out;
|
||||
}
|
||||
ntfs_log_info("Could not mount read-write, trying read-only\n");
|
||||
} else
|
||||
if (ctx->rw && ntfs_strinsert(&parsed_options, ",rw"))
|
||||
goto err_out;
|
||||
/* We must do this after ntfs_open() to be able to set the blksize */
|
||||
if (ctx->blkdev && set_fuseblk_options(&parsed_options))
|
||||
goto err_out;
|
||||
|
|
|
@ -85,6 +85,7 @@ const struct DEFOPTION optionlist[] = {
|
|||
{ "atime", OPT_ATIME, FLGOPT_BOGUS },
|
||||
{ "relatime", OPT_RELATIME, FLGOPT_BOGUS },
|
||||
{ "delay_mtime", OPT_DMTIME, FLGOPT_DECIMAL | FLGOPT_OPTIONAL },
|
||||
{ "rw", OPT_RW, FLGOPT_BOGUS },
|
||||
{ "fake_rw", OPT_FAKE_RW, FLGOPT_BOGUS },
|
||||
{ "fsname", OPT_FSNAME, FLGOPT_NOSUPPORT },
|
||||
{ "no_def_opts", OPT_NO_DEF_OPTS, FLGOPT_BOGUS },
|
||||
|
@ -291,6 +292,9 @@ char *parse_mount_options(ntfs_fuse_context_t *ctx,
|
|||
case OPT_FAKE_RW :
|
||||
ctx->ro = TRUE;
|
||||
break;
|
||||
case OPT_RW :
|
||||
ctx->rw = TRUE;
|
||||
break;
|
||||
case OPT_NOATIME :
|
||||
ctx->atime = ATIME_DISABLED;
|
||||
break;
|
||||
|
@ -542,6 +546,7 @@ char *parse_mount_options(ntfs_fuse_context_t *ctx,
|
|||
if (ctx->ro) {
|
||||
ctx->secure_flags &= ~(1 << SECURITY_ADDSECURIDS);
|
||||
ctx->hiberfile = FALSE;
|
||||
ctx->rw = FALSE;
|
||||
}
|
||||
exit:
|
||||
free(options);
|
||||
|
|
|
@ -51,6 +51,7 @@ enum {
|
|||
OPT_ATIME,
|
||||
OPT_RELATIME,
|
||||
OPT_DMTIME,
|
||||
OPT_RW,
|
||||
OPT_FAKE_RW,
|
||||
OPT_FSNAME,
|
||||
OPT_NO_DEF_OPTS,
|
||||
|
@ -135,6 +136,7 @@ typedef struct {
|
|||
ntfs_atime_t atime;
|
||||
s64 dmtime;
|
||||
BOOL ro;
|
||||
BOOL rw;
|
||||
BOOL show_sys_files;
|
||||
BOOL hide_hid_files;
|
||||
BOOL hide_dot_files;
|
||||
|
|
Loading…
Reference in New Issue