[PATCH V7 2/6] mtd: partitions: remove sysfs files when deleting all master's partitions
Rafał Miłecki
zajec5 at gmail.com
Thu Jun 22 14:40:47 PDT 2017
On 22 June 2017 at 23:05, Brian Norris <computersforpeace at gmail.com> wrote:
> On Wed, Jun 21, 2017 at 08:26:43AM +0200, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal at milecki.pl>
>>
>> When support for sysfs "offset" file was added it missed to update the
>> del_mtd_partitions function. It deletes partitions just like
>> mtd_del_partition does so both should also take care of removing sysfs
>> files.
>>
>> This change moves sysfs_remove_files call to the shared function to fix
>> this issue.
>>
>> Fixes: a62c24d755291 ("mtd: part: Add sysfs variable for offset of partition")
>> Cc: Dan Ehrenberg <dehrenberg at chromium.org>
>> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
>> ---
>> V7: Introduction of this patch, it was separated from the 1/6. It should
>> be clear now that this change is introduced. If something goes wrong
>> it should also be easier to revert it this way.
>
> Thanks, splitting this out is nice actually. And thanks for looking up
> the background on this oversight.
>
> I'm not really sure what the actual effect of that omission would be;
> the file won't be left dangling in sysfs (the device is removed
> entirely), but I'm not sure if that'd trigger some kind of internal
> kobject memory leak.
>
> Anyway, looks good to me.
In the worst case it looks like a small cleanup of the exit path.
> Side note: this patch series sort of massages the definition of this
> "offset" file. Now, IIUC, subpartitions will have an "offset" file
> relative to their parent partition, not the master flash device. I'm not
> sure which way is expected.
I didn't think about this. I should be able to easily get an absolute
offset if needed (a simple recursion), but I'm not sure what behavior
is actually expected. Since we use a tree struct in the sysfs now,
maybe relative offsets are actually correct ones?
--
Rafał
More information about the linux-mtd
mailing list