audit inode marks pin the inode so there is no need to set the FSNOTIFY_GROUP_NOFS flag.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -351,7 +351,7 @@ static void untag_chunk(struct audit_chunk *chunk, struct fsnotify_mark *mark) · 350 unmodified lines | ||
| 351 | 351 | struct audit_chunk *new; |
| 352 | 352 | int size; |
| 353 | 353 | |
| 354 | − mutex_lock(&audit_tree_group->mark_mutex); | |
| 354 | + fsnotify_group_lock(audit_tree_group); | |
| 355 | 355 | /* |
| 356 | 356 | * mark_mutex stabilizes chunk attached to the mark so we can check |
| 357 | 357 | * whether it didn't change while we've dropped hash_lock. |
| @@ -368,7 +368,7 @@ static void untag_chunk(struct audit_chunk *chunk, struct fsnotify_mark *mark) · 10 unmodified lines | ||
| 368 | 368 | replace_mark_chunk(mark, NULL); |
| 369 | 369 | spin_unlock(&hash_lock); |
| 370 | 370 | fsnotify_detach_mark(mark); |
| 371 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 371 | + fsnotify_group_unlock(audit_tree_group); | |
| 372 | 372 | audit_mark_put_chunk(chunk); |
| 373 | 373 | fsnotify_free_mark(mark); |
| 374 | 374 | return; |
| @@ -385,12 +385,12 @@ static void untag_chunk(struct audit_chunk *chunk, struct fsnotify_mark *mark) · 10 unmodified lines | ||
| 385 | 385 | */ |
| 386 | 386 | replace_chunk(new, chunk); |
| 387 | 387 | spin_unlock(&hash_lock); |
| 388 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 388 | + fsnotify_group_unlock(audit_tree_group); | |
| 389 | 389 | audit_mark_put_chunk(chunk); |
| 390 | 390 | return; |
| 391 | 391 | |
| 392 | 392 | out_mutex: |
| 393 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 393 | + fsnotify_group_unlock(audit_tree_group); | |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /* Call with group->mark_mutex held, releases it */ |
| @@ -400,19 +400,19 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree) · 3 unmodified lines | ||
| 400 | 400 | struct audit_chunk *chunk = alloc_chunk(1); |
| 401 | 401 | |
| 402 | 402 | if (!chunk) { |
| 403 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 403 | + fsnotify_group_unlock(audit_tree_group); | |
| 404 | 404 | return -ENOMEM; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | mark = alloc_mark(); |
| 408 | 408 | if (!mark) { |
| 409 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 409 | + fsnotify_group_unlock(audit_tree_group); | |
| 410 | 410 | kfree(chunk); |
| 411 | 411 | return -ENOMEM; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | if (fsnotify_add_inode_mark_locked(mark, inode, 0)) { |
| 415 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 415 | + fsnotify_group_unlock(audit_tree_group); | |
| 416 | 416 | fsnotify_put_mark(mark); |
| 417 | 417 | kfree(chunk); |
| 418 | 418 | return -ENOSPC; |
| @@ -422,7 +422,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree) · 3 unmodified lines | ||
| 422 | 422 | if (tree->goner) { |
| 423 | 423 | spin_unlock(&hash_lock); |
| 424 | 424 | fsnotify_detach_mark(mark); |
| 425 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 425 | + fsnotify_group_unlock(audit_tree_group); | |
| 426 | 426 | fsnotify_free_mark(mark); |
| 427 | 427 | fsnotify_put_mark(mark); |
| 428 | 428 | kfree(chunk); |
| @@ -444,7 +444,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree) · 15 unmodified lines | ||
| 444 | 444 | */ |
| 445 | 445 | insert_hash(chunk); |
| 446 | 446 | spin_unlock(&hash_lock); |
| 447 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 447 | + fsnotify_group_unlock(audit_tree_group); | |
| 448 | 448 | /* |
| 449 | 449 | * Drop our initial reference. When mark we point to is getting freed, |
| 450 | 450 | * we get notification through ->freeing_mark callback and cleanup |
| @@ -462,7 +462,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) · 11 unmodified lines | ||
| 462 | 462 | struct audit_node *p; |
| 463 | 463 | int n; |
| 464 | 464 | |
| 465 | − mutex_lock(&audit_tree_group->mark_mutex); | |
| 465 | + fsnotify_group_lock(audit_tree_group); | |
| 466 | 466 | mark = fsnotify_find_mark(&inode->i_fsnotify_marks, audit_tree_group); |
| 467 | 467 | if (!mark) |
| 468 | 468 | return create_chunk(inode, tree); |
| @@ -478,7 +478,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) · 9 unmodified lines | ||
| 478 | 478 | for (n = 0; n < old->count; n++) { |
| 479 | 479 | if (old->owners[n].owner == tree) { |
| 480 | 480 | spin_unlock(&hash_lock); |
| 481 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 481 | + fsnotify_group_unlock(audit_tree_group); | |
| 482 | 482 | fsnotify_put_mark(mark); |
| 483 | 483 | return 0; |
| 484 | 484 | } |
| @@ -487,7 +487,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) · 2 unmodified lines | ||
| 487 | 487 | |
| 488 | 488 | chunk = alloc_chunk(old->count + 1); |
| 489 | 489 | if (!chunk) { |
| 490 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 490 | + fsnotify_group_unlock(audit_tree_group); | |
| 491 | 491 | fsnotify_put_mark(mark); |
| 492 | 492 | return -ENOMEM; |
| 493 | 493 | } |
| @@ -495,7 +495,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) · 1 unmodified line | ||
| 495 | 495 | spin_lock(&hash_lock); |
| 496 | 496 | if (tree->goner) { |
| 497 | 497 | spin_unlock(&hash_lock); |
| 498 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 498 | + fsnotify_group_unlock(audit_tree_group); | |
| 499 | 499 | fsnotify_put_mark(mark); |
| 500 | 500 | kfree(chunk); |
| 501 | 501 | return 0; |
| @@ -515,7 +515,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) · 13 unmodified lines | ||
| 515 | 515 | */ |
| 516 | 516 | replace_chunk(chunk, old); |
| 517 | 517 | spin_unlock(&hash_lock); |
| 518 | − mutex_unlock(&audit_tree_group->mark_mutex); | |
| 518 | + fsnotify_group_unlock(audit_tree_group); | |
| 519 | 519 | fsnotify_put_mark(mark); /* pair to fsnotify_find_mark */ |
| 520 | 520 | audit_mark_put_chunk(old); |
| 521 | 521 | |
| @@ -1044,12 +1044,12 @@ static void audit_tree_freeing_mark(struct fsnotify_mark *mark, · 522 unmodified lines | ||
| 1044 | 1044 | { |
| 1045 | 1045 | struct audit_chunk *chunk; |
| 1046 | 1046 | |
| 1047 | − mutex_lock(&mark->group->mark_mutex); | |
| 1047 | + fsnotify_group_lock(mark->group); | |
| 1048 | 1048 | spin_lock(&hash_lock); |
| 1049 | 1049 | chunk = mark_chunk(mark); |
| 1050 | 1050 | replace_mark_chunk(mark, NULL); |
| 1051 | 1051 | spin_unlock(&hash_lock); |
| 1052 | − mutex_unlock(&mark->group->mark_mutex); | |
| 1052 | + fsnotify_group_unlock(mark->group); | |
| 1053 | 1053 | if (chunk) { |
| 1054 | 1054 | evict_chunk(chunk); |
| 1055 | 1055 | audit_mark_put_chunk(chunk); |