[bug report] bcachefs: Update export_operations for snapshots

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Kent Overstreet,

The patch 85e95ca7cc48: "bcachefs: Update export_operations for
snapshots" from Nov 13, 2021 (linux-next), leads to the following
Smatch static checker warning:

	fs/exportfs/expfs.c:140 reconnect_one()
	warn: 'parent' can also be NULL

fs/exportfs/expfs.c
    121 static struct dentry *reconnect_one(struct vfsmount *mnt,
    122                 struct dentry *dentry, char *nbuf)
    123 {
    124         struct dentry *parent;
    125         struct dentry *tmp;
    126         int err;
    127 
    128         parent = ERR_PTR(-EACCES);
    129         inode_lock(dentry->d_inode);
    130         if (mnt->mnt_sb->s_export_op->get_parent)
    131                 parent = mnt->mnt_sb->s_export_op->get_parent(dentry);

Smatch is complaining that bch2_get_parent() returns NULL:

85e95ca7cc48c (Kent Overstreet  2021-11-13 19:49:14 -0500 1216)         if (!parent_inum.inum)
85e95ca7cc48c (Kent Overstreet  2021-11-13 19:49:14 -0500 1217)                 return NULL;

I think it should be an error pointer?

    132         inode_unlock(dentry->d_inode);
    133 
    134         if (IS_ERR(parent)) {
    135                 dprintk("get_parent of %lu failed, err %ld\n",
    136                         dentry->d_inode->i_ino, PTR_ERR(parent));
    137                 return parent;
    138         }
    139 
--> 140         dprintk("%s: find name of %lu in %lu\n", __func__,
    141                 dentry->d_inode->i_ino, parent->d_inode->i_ino);
                                                ^^^^^^^^

    142         err = exportfs_get_name(mnt, parent, nbuf, dentry);
    143         if (err == -ENOENT)
    144                 goto out_reconnected;
    145         if (err)

regards,
dan carpenter



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux