From: Richard Weinberger <richard@nod.at>
To: "Rafał Miłecki" <zajec5@gmail.com>,
"Miklos Szeredi" <miklos@szeredi.hu>,
linux-unionfs@vger.kernel.org,
"Artem Bityutskiy" <dedekind1@gmail.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
linux-mtd@lists.infradead.org
Cc: lede-dev@lists.infradead.org
Subject: Re: overlayfs + ubifs: power cut results in "failed to create directory /overlay/work/work (errno: 17); mounting read-only"
Date: Tue, 6 Sep 2016 13:59:11 +0200 [thread overview]
Message-ID: <d56ee9a9-5246-a609-b8ca-1c8dee322f46@nod.at> (raw)
In-Reply-To: <58c7c482-9a51-73d1-7694-e1928f3bedb0@gmail.com>
Rafał,
On 06.09.2016 12:46, Rafał Miłecki wrote:
> Hi,
>
> In LEDE/OpenWrt we use UBI with two volumes: "rootfs" and "rootfs_data". With
> rootfs mounted at / we mount rootfs_data volume at /overlay and then use
> overlayfs to combine these two.
>
> 1) Before:
> /dev/root on / type squashfs (ro,relatime)
> /dev/ubi0_1 on /overlay type ubifs (rw,noatime)
>
> 2) Mounting overlayfs
> mount("overlayfs:/overlay", "/mnt", "overlay", MS_NOATIME, "lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work")
>
> 3) After:
> /dev/root on / type squashfs (ro,relatime)
> /dev/ubi0_1 on /overlay type ubifs (rw,noatime)
> overlayfs:/overlay on /mnt type overlay (ro,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
>
> It works fine as long as there aren't unexpected power cuts. I can easily break
> it in a well-reproducible way by doing:
> date > bar.txt && rm foo.sh
> sleep 2s
> [power cut]
>
> On the next boot LEDE/OpenWrt script calls the same mount function but it
> results in:
> [ 10.017235] overlayfs: failed to create directory /overlay/work/work (errno: 17); mounting read-only
>
> I tracked that error and got a following forward trace for it:
> ovl_fill_super
> ovl_workdir_create
> ovl_cleanup
> vfs_rmdir
> ubifs_rmdir
> check_dir_empty
>
> In other words mounting overlayfs fails because ubifs refuses to remove
> work/work as this directory is not empty. On a clean boot /overlay/work/work is
> empty and everything works fine but after a power cut I can see
> /overlay/work/work/#c752f2a8 file.
>
> I don't really know anything about overlayfs and its workdir, I just expected
> overlayfs to recover from such situation on its own. FWIW after a power cut and
> reboot my bar.txt is an empty file and foo.sh still exists.
>
> Does it sound like an overlayfs issue to you? Can you think of some way of
> fixing this?
overlayfs does not issue a recursive rm on workdir, AFAICT you are supposed to cleanup
workdir yourself before mounting.
Miklos?
Thanks,
//richard
next prev parent reply other threads:[~2016-09-06 11:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 10:46 overlayfs + ubifs: power cut results in "failed to create directory /overlay/work/work (errno: 17); mounting read-only" Rafał Miłecki
2016-09-06 11:59 ` Richard Weinberger [this message]
2016-09-06 12:50 ` Miklos Szeredi
2016-09-06 12:56 ` Rafał Miłecki
2016-09-06 15:53 ` Rafał Miłecki
2016-09-07 8:28 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d56ee9a9-5246-a609-b8ca-1c8dee322f46@nod.at \
--to=richard@nod.at \
--cc=adrian.hunter@intel.com \
--cc=dedekind1@gmail.com \
--cc=lede-dev@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).