Skip to content

Commit 538f4f0

Browse files
committed
fs: add kernel doc for mnt_{hold,unhold}_writers()
When I introduced mnt_{hold,unhold}_writers() in commit fbdc2f6 ("fs: split out functions to hold writers") I did not add kernel doc for them. Fix this and introduce proper documentation. Link: https://lore.kernel.org/r/20220203131411.3093040-4-brauner@kernel.org Fixes: fbdc2f6 ("fs: split out functions to hold writers") Cc: Seth Forshee <seth.forshee@digitalocean.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 97acd70 commit 538f4f0

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

fs/namespace.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,24 @@ void mnt_drop_write_file(struct file *file)
469469
}
470470
EXPORT_SYMBOL(mnt_drop_write_file);
471471

472+
/**
473+
* mnt_hold_writers - prevent write access to the given mount
474+
* @mnt: mnt to prevent write access to
475+
*
476+
* Prevents write access to @mnt if there are no active writers for @mnt.
477+
* This function needs to be called and return successfully before changing
478+
* properties of @mnt that need to remain stable for callers with write access
479+
* to @mnt.
480+
*
481+
* After this functions has been called successfully callers must pair it with
482+
* a call to mnt_unhold_writers() in order to stop preventing write access to
483+
* @mnt.
484+
*
485+
* Context: This function expects lock_mount_hash() to be held serializing
486+
* setting MNT_WRITE_HOLD.
487+
* Return: On success 0 is returned.
488+
* On error, -EBUSY is returned.
489+
*/
472490
static inline int mnt_hold_writers(struct mount *mnt)
473491
{
474492
mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
@@ -500,6 +518,18 @@ static inline int mnt_hold_writers(struct mount *mnt)
500518
return 0;
501519
}
502520

521+
/**
522+
* mnt_unhold_writers - stop preventing write access to the given mount
523+
* @mnt: mnt to stop preventing write access to
524+
*
525+
* Stop preventing write access to @mnt allowing callers to gain write access
526+
* to @mnt again.
527+
*
528+
* This function can only be called after a successful call to
529+
* mnt_hold_writers().
530+
*
531+
* Context: This function expects lock_mount_hash() to be held.
532+
*/
503533
static inline void mnt_unhold_writers(struct mount *mnt)
504534
{
505535
/*

0 commit comments

Comments
 (0)