diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 7d0c8a197575..1eab6dbb4c5f 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -766,7 +766,8 @@ xfs_file_dio_write_aligned( trace_xfs_file_direct_write(iocb, from); ret = iomap_dio_rw(iocb, from, ops, dops, dio_flags, ac, 0); out_unlock: - xfs_iunlock(ip, iolock); + if (iolock) + xfs_iunlock(ip, iolock); return ret; }