[CRIU] [PATCH] btrfs: Don't fail if we meet non-subvolume mountpoint
Cyrill Gorcunov
gorcunov at gmail.com
Thu Dec 5 03:19:31 PST 2013
On Thu, Dec 05, 2013 at 03:10:01PM +0400, Pavel Emelyanov wrote:
> >
> > - if (stat(m->mountpoint, &st)) {
> > - pr_perror("Can't get stat on %s", m->mountpoint);
> > + if (st.st_ino != BTRFS_FIRST_FREE_OBJECTID)
> > + return ERR_PTR(-ENOENT);
> > +
> > + fd = open(m->mountpoint, O_RDONLY);
> > + if (fd < 0) {
> > + pr_perror("Can't open %s", m->mountpoint);
>
> Don't do start + open. Do open + fstat.
How it's different? If we hit non BTRFS_FIRST_FREE_OBJECTID we exit earlier.
> >
> > int btrfs_parse_mountinfo(struct mount_info *m)
> > {
> > - return btrfs_parse_volume(m) ? 0 : -1;
> > + struct btrfs_subvol_root *r;
> > +
> > + r = btrfs_parse_volume(m);
> > + if (IS_ERR(r)) {
> > + if (PTR_ERR(r) == -ENOENT)
> > + return 0;
> > + return -1;
> > + }
> > + return r ? 0 : -1;
>
> This looks tricky. Why not make btrfs_parse_volume() return int and
> decide when to report error and when not itself?
>
I think I'll need to use this btrfs_subvol_root returned pointer for
lazy scheme (the patch in current stat become smaller in size, that's
the only idea I carried for now).
More information about the CRIU
mailing list