Revision b8250344
Added by Renato Botelho over 11 years ago
etc/inc/config.lib.inc | ||
---|---|---|
308 | 308 |
if($g['platform'] == "cdrom" or $g['platform'] == "pfSense") |
309 | 309 |
return; |
310 | 310 |
|
311 |
if (!isset($config['system']['nanobsd_force_rw']) && (refcount_reference(1000) > 1)) |
|
312 |
return; |
|
313 |
|
|
314 |
if (isset($config['system']['nanobsd_force_rw']) && is_writable("/")) |
|
311 |
if ((refcount_reference(1000) > 1) && is_writable("/")) |
|
315 | 312 |
return; |
316 | 313 |
|
317 | 314 |
$status = mwexec("/sbin/mount -u -w -o sync,noatime {$g['cf_path']}"); |
... | ... | |
348 | 345 |
/* Do not trust $g['platform'] since this can be clobbered during factory reset. */ |
349 | 346 |
$platform = trim(file_get_contents("/etc/platform")); |
350 | 347 |
/* do not umount on cdrom or pfSense platforms */ |
351 |
if($platform == "cdrom" or $platform == "pfSense" or isset($config['system']['nanobsd_force_rw']))
|
|
348 |
if($platform == "cdrom" or $platform == "pfSense") |
|
352 | 349 |
return; |
353 | 350 |
|
354 | 351 |
if (refcount_unreference(1000) > 0) |
355 | 352 |
return; |
356 | 353 |
|
354 |
if(isset($config['system']['nanobsd_force_rw'])) |
|
355 |
return; |
|
356 |
|
|
357 | 357 |
if($g['booting']) |
358 | 358 |
return; |
359 | 359 |
|
usr/local/www/diag_nanobsd.php | ||
---|---|---|
108 | 108 |
} |
109 | 109 |
|
110 | 110 |
if ($_POST['setrw']) { |
111 |
if (isset($_POST['nanobsd_force_rw'])) { |
|
112 |
if (!is_writable("/")) { |
|
113 |
conf_mount_rw(); |
|
114 |
} |
|
111 |
conf_mount_rw(); |
|
112 |
if (isset($_POST['nanobsd_force_rw'])) |
|
115 | 113 |
$config['system']['nanobsd_force_rw'] = true; |
116 |
} else {
|
|
114 |
else
|
|
117 | 115 |
unset($config['system']['nanobsd_force_rw']); |
118 |
} |
|
119 | 116 |
|
120 | 117 |
write_config("Changed Permanent Read/Write Setting"); |
121 | 118 |
conf_mount_ro(); |
... | ... | |
175 | 172 |
<form action="diag_nanobsd.php" method="post" name="iform"> |
176 | 173 |
<?php if (is_writable("/")) { |
177 | 174 |
$refcount = refcount_read(1000); |
178 |
if ($refcount == 1) { |
|
175 |
/* refcount_read returns -1 when shared memory section does not exist */ |
|
176 |
if ($refcount == 1 || $refcount == -1) { |
|
179 | 177 |
$refdisplay = ""; |
180 | 178 |
} else { |
181 | 179 |
$refdisplay = " (reference count " . $refcount . ")"; |
Also available in: Unified diff
Fix #3235
. diag_nanobsd.php:
. Since conf_mount_ro() is always being called, always call
conf_mount_rw to keep refcount correct
. Do not show refcount_read() return when it's -1
. config.lib.inc
. Increment and decrement refcount even if nanobsd_force_rw is set.
This is necessary to avoid partition being mounted as RO when
nanobsd_force_rw is disabled and any process requested it to be RW