Re: [RFC PATCH] libfcoe: Replace module state checking with global flag checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2011-03-11 at 18:07 -0800, Robert Love wrote:
> libfcoe uses module parameters for its create, destroy,
> etc... interfaces. The user land application will write
> the name of the netdevice to these interface files to
> trigger the kernel to take some action.
> 
> Module parameter sysfs files are both present and writable
> before the module has completed its initialization routine.
> This means that the user could call 'create' before
> libfcoe's global data structures have been initialized.
> 
> The current solution is to check the module's state in
> the sysfs store functions and if the module is not
> MODULE_STATE_LIVE the sysfs store routine will immediately
> exit, thus not doing anything if the module has not
> completed initialization. This solution is not sufficient
> because it expects THIS_MODULE to have been initialized,
> which is not guaranteed.
> 
> This patch adds a global (to libfcoe) atomic variable
> which is used to track the modules initialization state.
> In other words, this patch uses a flag to indicate
> whether the module has completed initialization or not.

OK, so this isn't really the way to do it, because you've just replaced
one race condition with another: The race is that the module can go dead
immediately after you make your liveness checks.  The fix is that you
want the correct lifetime rules on the objects.

For the sysfs files, that means using them properly, so they don't
appear until the module is ready to begin processing calls and they
disappear *before* you begin teardown.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux