Skip to content

Commit d1c53de

Browse files
committed
Revert "ovl: pass realinode to ovl_encode_real_fh() instead of realdentry"
This reverts commit a3f8a2b which is commit 07aeefa upstream. It is reported to part of a series that causes problems in the 6.6.y tree, so revert it at this point in time and it can come back later if still needed. Reported-by: Ignat Korchagin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Dmitry Safonov <[email protected]> Cc: Amir Goldstein <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 950b604 commit d1c53de

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

fs/overlayfs/copy_up.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,13 @@ int ovl_set_attr(struct ovl_fs *ofs, struct dentry *upperdentry,
371371
return err;
372372
}
373373

374-
struct ovl_fh *ovl_encode_real_fh(struct ovl_fs *ofs, struct inode *realinode,
374+
struct ovl_fh *ovl_encode_real_fh(struct ovl_fs *ofs, struct dentry *real,
375375
bool is_upper)
376376
{
377377
struct ovl_fh *fh;
378378
int fh_type, dwords;
379379
int buflen = MAX_HANDLE_SZ;
380-
uuid_t *uuid = &realinode->i_sb->s_uuid;
380+
uuid_t *uuid = &real->d_sb->s_uuid;
381381
int err;
382382

383383
/* Make sure the real fid stays 32bit aligned */
@@ -394,8 +394,7 @@ struct ovl_fh *ovl_encode_real_fh(struct ovl_fs *ofs, struct inode *realinode,
394394
* the price or reconnecting the dentry.
395395
*/
396396
dwords = buflen >> 2;
397-
fh_type = exportfs_encode_inode_fh(realinode, (void *)fh->fb.fid,
398-
&dwords, NULL, 0);
397+
fh_type = exportfs_encode_fh(real, (void *)fh->fb.fid, &dwords, 0);
399398
buflen = (dwords << 2);
400399

401400
err = -EIO;
@@ -437,7 +436,7 @@ struct ovl_fh *ovl_get_origin_fh(struct ovl_fs *ofs, struct dentry *origin)
437436
if (!ovl_can_decode_fh(origin->d_sb))
438437
return NULL;
439438

440-
return ovl_encode_real_fh(ofs, d_inode(origin), false);
439+
return ovl_encode_real_fh(ofs, origin, false);
441440
}
442441

443442
int ovl_set_origin_fh(struct ovl_fs *ofs, const struct ovl_fh *fh,
@@ -462,7 +461,7 @@ static int ovl_set_upper_fh(struct ovl_fs *ofs, struct dentry *upper,
462461
const struct ovl_fh *fh;
463462
int err;
464463

465-
fh = ovl_encode_real_fh(ofs, d_inode(upper), true);
464+
fh = ovl_encode_real_fh(ofs, upper, true);
466465
if (IS_ERR(fh))
467466
return PTR_ERR(fh);
468467

fs/overlayfs/export.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ static int ovl_check_encode_origin(struct dentry *dentry)
228228
static int ovl_dentry_to_fid(struct ovl_fs *ofs, struct dentry *dentry,
229229
u32 *fid, int buflen)
230230
{
231-
struct inode *inode = d_inode(dentry);
232231
struct ovl_fh *fh = NULL;
233232
int err, enc_lower;
234233
int len;
@@ -242,8 +241,8 @@ static int ovl_dentry_to_fid(struct ovl_fs *ofs, struct dentry *dentry,
242241
goto fail;
243242

244243
/* Encode an upper or lower file handle */
245-
fh = ovl_encode_real_fh(ofs, enc_lower ? ovl_inode_lower(inode) :
246-
ovl_inode_upper(inode), !enc_lower);
244+
fh = ovl_encode_real_fh(ofs, enc_lower ? ovl_dentry_lower(dentry) :
245+
ovl_dentry_upper(dentry), !enc_lower);
247246
if (IS_ERR(fh))
248247
return PTR_ERR(fh);
249248

fs/overlayfs/namei.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ int ovl_verify_origin_xattr(struct ovl_fs *ofs, struct dentry *dentry,
536536
struct ovl_fh *fh;
537537
int err;
538538

539-
fh = ovl_encode_real_fh(ofs, d_inode(real), is_upper);
539+
fh = ovl_encode_real_fh(ofs, real, is_upper);
540540
err = PTR_ERR(fh);
541541
if (IS_ERR(fh)) {
542542
fh = NULL;
@@ -732,7 +732,7 @@ int ovl_get_index_name(struct ovl_fs *ofs, struct dentry *origin,
732732
struct ovl_fh *fh;
733733
int err;
734734

735-
fh = ovl_encode_real_fh(ofs, d_inode(origin), false);
735+
fh = ovl_encode_real_fh(ofs, origin, false);
736736
if (IS_ERR(fh))
737737
return PTR_ERR(fh);
738738

fs/overlayfs/overlayfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ int ovl_copy_up_with_data(struct dentry *dentry);
832832
int ovl_maybe_copy_up(struct dentry *dentry, int flags);
833833
int ovl_copy_xattr(struct super_block *sb, const struct path *path, struct dentry *new);
834834
int ovl_set_attr(struct ovl_fs *ofs, struct dentry *upper, struct kstat *stat);
835-
struct ovl_fh *ovl_encode_real_fh(struct ovl_fs *ofs, struct inode *realinode,
835+
struct ovl_fh *ovl_encode_real_fh(struct ovl_fs *ofs, struct dentry *real,
836836
bool is_upper);
837837
struct ovl_fh *ovl_get_origin_fh(struct ovl_fs *ofs, struct dentry *origin);
838838
int ovl_set_origin_fh(struct ovl_fs *ofs, const struct ovl_fh *fh,

0 commit comments

Comments
 (0)