@@ -1270,8 +1270,16 @@ dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag,
1270
1270
* (e.g. it could be destroyed). Therefore you shouldn't do anything to the
1271
1271
* dataset except release it.
1272
1272
*
1273
- * User-initiated operations (e.g. ioctls, zfs_ioc_*()) are either read-only
1274
- * or modifying operations.
1273
+ * Operations generally fall somewhere into the following taxonomy:
1274
+ *
1275
+ * Read-Only Modifying
1276
+ *
1277
+ * Dataset Layer / MOS zfs get zfs destroy
1278
+ *
1279
+ * Individual Dataset read() write()
1280
+ *
1281
+ *
1282
+ * Dataset Layer Operations
1275
1283
*
1276
1284
* Modifying operations should generally use dsl_sync_task(). The synctask
1277
1285
* infrastructure enforces proper locking strategy with respect to the
@@ -1281,6 +1289,25 @@ dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag,
1281
1289
* information from the dataset, then release the pool and dataset.
1282
1290
* dmu_objset_{hold,rele}() are convenience routines that also do the pool
1283
1291
* hold/rele.
1292
+ *
1293
+ *
1294
+ * Operations On Individual Datasets
1295
+ *
1296
+ * Objects _within_ an objset should only be modified by the current 'owner'
1297
+ * of the objset to prevent incorrect concurrent modification. Thus, use
1298
+ * {dmu_objset,dsl_dataset}_own to mark some entity as the current owner,
1299
+ * and fail with EBUSY if there is already an owner. The owner can then
1300
+ * implement its own locking strategy, independent of the dataset layer's
1301
+ * locking infrastructure.
1302
+ * (E.g., the ZPL has its own set of locks to control concurrency. A regular
1303
+ * vnop will not reach into the dataset layer).
1304
+ *
1305
+ * Ideally, objects would also only be read by the objset’s owner, so that we
1306
+ * don’t observe state mid-modification.
1307
+ * (E.g. the ZPL is creating a new object and linking it into a directory; if
1308
+ * you don’t coordinate with the ZPL to hold ZPL-level locks, you could see an
1309
+ * intermediate state. The ioctl level violates this but in pretty benign
1310
+ * ways, e.g. reading the zpl props object.)
1284
1311
*/
1285
1312
1286
1313
int
0 commit comments