Fix coverity defects

coverity scan CID:147504 Type: Explicit null dereferenced
Reason: passing null pointer dl to zfs_dirent_unlock

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: BearBabyLiu <liu.huang@zte.com.cn>
Closes #5131
This commit is contained in:
BearBabyLiu 2016-09-21 10:09:22 +08:00 committed by Brian Behlendorf
parent 9911a9c4c9
commit 609603a5d3

View File

@ -1470,8 +1470,10 @@ zfs_create(struct inode *dip, char *name, vattr_t *vap, int excl,
if (S_ISREG(ZTOI(zp)->i_mode) &&
(vap->va_mask & ATTR_SIZE) && (vap->va_size == 0)) {
/* we can't hold any locks when calling zfs_freesp() */
zfs_dirent_unlock(dl);
dl = NULL;
if (dl) {
zfs_dirent_unlock(dl);
dl = NULL;
}
error = zfs_freesp(zp, 0, 0, mode, TRUE);
}
}