ovl: encode lower file handles

For indexed or lower non-dir, encode a non-connectable lower file handle
from origin inode. For indexed or lower dir, when ofs->numlower == 1,
encode a lower file handle from lower dir.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
Amir Goldstein 2017-12-28 19:35:21 +02:00 committed by Miklos Szeredi
parent 05e1f11816
commit 03e1c584ff

View File

@ -90,7 +90,6 @@ static int ovl_encode_maybe_copy_up(struct dentry *dentry)
static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen) static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen)
{ {
struct dentry *upper;
struct dentry *origin = ovl_dentry_lower(dentry); struct dentry *origin = ovl_dentry_lower(dentry);
struct ovl_fh *fh = NULL; struct ovl_fh *fh = NULL;
int err; int err;
@ -107,13 +106,8 @@ static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen)
origin = NULL; origin = NULL;
} }
upper = ovl_dentry_upper(dentry); /* Encode an upper or origin file handle */
err = -EACCES; fh = ovl_encode_fh(origin ?: ovl_dentry_upper(dentry), !origin);
if (!upper || origin)
goto fail;
/* TODO: encode non pure-upper by origin */
fh = ovl_encode_fh(upper, true);
err = -EOVERFLOW; err = -EOVERFLOW;
if (fh->len > buflen) if (fh->len > buflen)