overlayfs + ubifs: power cut results in "failed to create directory /overlay/work/work (errno: 17); mounting read-only"

Miklos Szeredi miklos at szeredi.hu
Wed Sep 7 01:28:02 PDT 2016


On Tue, Sep 6, 2016 at 5:53 PM, Rafał Miłecki <zajec5 at gmail.com> wrote:
> On 6 September 2016 at 14:56, Rafał Miłecki <zajec5 at gmail.com> wrote:
>> On 6 September 2016 at 14:50, Miklos Szeredi <miklos at szeredi.hu> wrote:
>>> On Tue, Sep 6, 2016 at 1:59 PM, Richard Weinberger <richard at nod.at> wrote:
>>>> overlayfs does not issue a recursive rm on workdir, AFAICT you are supposed to cleanup
>>>> workdir yourself before mounting.
>>>> Miklos?
>>>
>>> Fixed in 4.8-rc5 by
>>>
>>> eea2fb4851e9 ("ovl: proper cleanup of workdir")
>>>
>>> I think it's better if kernel does the cleanup, but if it's easier to
>>> upgrade userspace, then that's a valid workaround.
>>
>> Oh, this should solve my problem! It seems it didn't git stable
>> kernels yet, but I can backport it on my own for now.
>
> I tried backporting it to 4.4, but it appears it won't be that
> trivial. Your patch ("ovl: proper cleanup of workdir") uses e.g.
> inode_lock_nested which is available in 4.5+. Commit that added this
> function: 5955102c9984f ("wrappers for ->i_mutex access") wasn't
> marked for stable, so I guess your patch won't go into 4.4 at all.
>
> I don't expect any magic solution for this, just saying, leaving a
> note for reference.

Conversion is trivial, in fact:

#define inode_lock(inode) mutex_lock(&(inode)->i_mutex)
#define inode_unlock(inode) mutex_unlock(&(inode)->i_mutex)
#define inode_trylock(inode) mutex_trylock(&(inode)->i_mutex)
#define inode_lock_nested(inode, subclass)
mutex_lock_nested(&(inode)->i_mutex, subclass)

And Greg promised to put these defines into -stable for easier
backport experience.

Thanks,
Miklos



More information about the linux-mtd mailing list