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
1 changed files with 4 additions and 2 deletions

View File

@ -1470,8 +1470,10 @@ top:
if (S_ISREG(ZTOI(zp)->i_mode) && if (S_ISREG(ZTOI(zp)->i_mode) &&
(vap->va_mask & ATTR_SIZE) && (vap->va_size == 0)) { (vap->va_mask & ATTR_SIZE) && (vap->va_size == 0)) {
/* we can't hold any locks when calling zfs_freesp() */ /* we can't hold any locks when calling zfs_freesp() */
if (dl) {
zfs_dirent_unlock(dl); zfs_dirent_unlock(dl);
dl = NULL; dl = NULL;
}
error = zfs_freesp(zp, 0, 0, mode, TRUE); error = zfs_freesp(zp, 0, 0, mode, TRUE);
} }
} }