Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 49c482f

Browse files
authored
dsl_pool: extend comment on DSL Pool Configuration Lock
Based on a conversation with Matt on the OpenZFS Slack. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Signed-off-by: Christian Schwarz <[email protected]> Closes openzfs#11370
1 parent 1c0bbd5 commit 49c482f

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

module/zfs/dsl_pool.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,8 +1270,16 @@ dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag,
12701270
* (e.g. it could be destroyed). Therefore you shouldn't do anything to the
12711271
* dataset except release it.
12721272
*
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
12751283
*
12761284
* Modifying operations should generally use dsl_sync_task(). The synctask
12771285
* 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,
12811289
* information from the dataset, then release the pool and dataset.
12821290
* dmu_objset_{hold,rele}() are convenience routines that also do the pool
12831291
* 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.)
12841311
*/
12851312

12861313
int

0 commit comments

Comments
 (0)