Use file_dentry and file_inode wrappers

Fix bugs due to kernel change in torvalds/linux@4bacc9c923 ("overlayfs:
Make f_path always point to the overlay and f_inode to the underlay").

This problem crashes system when use zfs as a layer of overlayfs.

Signed-off-by: Chen Haiquan <oc@yunify.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4914
Closes #4935
This commit is contained in:
Chen Haiquan
2016-08-04 23:57:35 +08:00
committed by Brian Behlendorf
parent d5884c3453
commit d9c97ec08b
6 changed files with 41 additions and 9 deletions
+3 -3
View File
@@ -52,7 +52,7 @@ zpl_common_open(struct inode *ip, struct file *filp)
static int
zpl_root_iterate(struct file *filp, struct dir_context *ctx)
{
zfs_sb_t *zsb = ITOZSB(filp->f_path.dentry->d_inode);
zfs_sb_t *zsb = ITOZSB(file_inode(filp));
int error = 0;
ZFS_ENTER(zsb);
@@ -249,7 +249,7 @@ zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry,
static int
zpl_snapdir_iterate(struct file *filp, struct dir_context *ctx)
{
zfs_sb_t *zsb = ITOZSB(filp->f_path.dentry->d_inode);
zfs_sb_t *zsb = ITOZSB(file_inode(filp));
fstrans_cookie_t cookie;
char snapname[MAXNAMELEN];
boolean_t case_conflict;
@@ -447,7 +447,7 @@ zpl_shares_iterate(struct file *filp, struct dir_context *ctx)
{
fstrans_cookie_t cookie;
cred_t *cr = CRED();
zfs_sb_t *zsb = ITOZSB(filp->f_path.dentry->d_inode);
zfs_sb_t *zsb = ITOZSB(file_inode(filp));
znode_t *dzp;
int error = 0;