| 1318 | } |
| 1319 | |
| 1320 | void |
| 1321 | zfs_zinactive(znode_t *zp) |
| 1322 | { |
| 1323 | zfsvfs_t *zfsvfs = ZTOZSB(zp); |
| 1324 | uint64_t z_id = zp->z_id; |
| 1325 | znode_hold_t *zh; |
| 1326 | |
| 1327 | ASSERT(zp->z_sa_hdl); |
| 1328 | |
| 1329 | /* |
| 1330 | * Don't allow a zfs_zget() while were trying to release this znode. |
| 1331 | */ |
| 1332 | zh = zfs_znode_hold_enter(zfsvfs, z_id); |
| 1333 | |
| 1334 | mutex_enter(&zp->z_lock); |
| 1335 | |
| 1336 | /* |
| 1337 | * If this was the last reference to a file with no links, remove |
| 1338 | * the file from the file system unless the file system is mounted |
| 1339 | * read-only. That can happen, for example, if the file system was |
| 1340 | * originally read-write, the file was opened, then unlinked and |
| 1341 | * the file system was made read-only before the file was finally |
| 1342 | * closed. The file will remain in the unlinked set. |
| 1343 | */ |
| 1344 | if (zp->z_unlinked) { |
| 1345 | ASSERT(!zfsvfs->z_issnap); |
| 1346 | if (!zfs_is_readonly(zfsvfs) && !zfs_unlink_suspend_progress) { |
| 1347 | mutex_exit(&zp->z_lock); |
| 1348 | zfs_znode_hold_exit(zfsvfs, zh); |
| 1349 | zfs_rmnode(zp); |
| 1350 | return; |
| 1351 | } |
| 1352 | } |
| 1353 | |
| 1354 | mutex_exit(&zp->z_lock); |
| 1355 | zfs_znode_dmu_fini(zp); |
| 1356 | |
| 1357 | zfs_znode_hold_exit(zfsvfs, zh); |
| 1358 | } |
| 1359 | |
| 1360 | #if defined(HAVE_INODE_TIMESPEC64_TIMES) |
| 1361 | #define zfs_compare_timespec timespec64_compare |
no test coverage detected