Project

General

Profile

Bug #3235

Could not open shared memory for read 1000

Added by Phillip Davis over 7 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
09/25/2013
Due date:
% Done:

100%

Estimated time:
Affected Version:
2.1
Affected Architecture:

Description

Reported in forum: http://forum.pfsense.org/index.php/topic,66764.0.html
System logs: php: /diag_nanobsd.php: Could not open shared memory for read 1000

This happens when nanoBSD force RW is enabled.

The shared memory section is used for tracking the number of things that have the filesystem mounted RW ("mount count"), and when the count returns to zero the file system is mounted RO. But when nanoBSD force RW is enabled, the shared memory section is not needed, so it never gets created.

But some code like diag_nanobsd tries to read the shared memory section.

Also, when nanoBSD force RW is disabled, there is no current mount count. So the section gets created with count 0, then conf_mount_ro is called, the count is decremented to -1 and the following diagnostic message is logged:
php: /diag_nanobsd.php: Reference 1000 is going negative, not doing unreference.
Actually, at this point there could be other processes that are doing writes, so it is not guaranteed that the filesystem can be immediately put back to RO immediately when nanoBSD force RW is disabled. IMHO all these issues would be solved of we create and maintain the reference count always, even when nanoBSD force RW is in effect.
I am happy to propose a new solution (better than what I first proposed in pull request 805).

Associated revisions

Revision 785158c6 (diff)
Added by Renato Botelho over 7 years ago

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

Revision b8250344 (diff)
Added by Renato Botelho over 7 years ago

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

History

#1 Updated by Renato Botelho over 7 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

#3 Updated by Phillip Davis over 7 years ago

Tested on a stock 2.1-RELEASE test system. Set Permanent Read/Write, rebooted.
Diagnostics->NanoBSD shows reference count -1
This message is in the system log:
Oct 25 11:46:58 php: /diag_nanobsd.php: Could not open shared memory for read 1000

Applied the 2 files from this change.
Rebooted again.
reference count now shows 0 (good)
no message in the system log

Looks like a good thing.

#4 Updated by Renato Botelho about 7 years ago

  • Status changed from Feedback to Resolved

Also available in: Atom PDF