[Devel] [PATCH RHEL7 COMMIT] ms/fs: add kernel doc for mnt_{hold, unhold}_writers()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Mar 29 20:53:55 MSK 2024


The commit is pushed to "branch-rh7-3.10.0-1160.108.1.vz7.221.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.108.1.vz7.221.2
------>
commit f65288fb954149f8e0388b41ab01b2aa8c500680
Author: Christian Brauner <brauner at kernel.org>
Date:   Thu Feb 3 14:14:07 2022 +0100

    ms/fs: add kernel doc for mnt_{hold,unhold}_writers()
    
    When I introduced mnt_{hold,unhold}_writers() in commit fbdc2f6c40f6
    ("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
    mFixes: fbdc2f6c40f6 ("fs: split out functions to hold writers")
    Cc: Seth Forshee <seth.forshee at digitalocean.com>
    Cc: Christoph Hellwig <hch at lst.de>
    Cc: Al Viro <viro at zeniv.linux.org.uk>
    Cc: linux-fsdevel at vger.kernel.org
    Reviewed-by: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Christian Brauner <brauner at kernel.org>
    
    https://virtuozzo.atlassian.net/browse/PSBM-153598
    (cherry picked from commit 538f4f022a4612f969d5324ee227403c9f8b1d72)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/namespace.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/fs/namespace.c b/fs/namespace.c
index 49d972024249..6e89af4a66a0 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -570,6 +570,24 @@ void mnt_drop_write_file(struct file *file)
 }
 EXPORT_SYMBOL(mnt_drop_write_file);
 
+/**
+ * mnt_hold_writers - prevent write access to the given mount
+ * @mnt: mnt to prevent write access to
+ *
+ * Prevents write access to @mnt if there are no active writers for @mnt.
+ * This function needs to be called and return successfully before changing
+ * properties of @mnt that need to remain stable for callers with write access
+ * to @mnt.
+ *
+ * After this functions has been called successfully callers must pair it with
+ * a call to mnt_unhold_writers() in order to stop preventing write access to
+ * @mnt.
+ *
+ * Context: This function expects lock_mount_hash() to be held serializing
+ *          setting MNT_WRITE_HOLD.
+ * Return: On success 0 is returned.
+ *	   On error, -EBUSY is returned.
+ */
 static inline int mnt_hold_writers(struct mount *mnt)
 {
 	mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
@@ -601,6 +619,18 @@ static inline int mnt_hold_writers(struct mount *mnt)
 	return 0;
 }
 
+/**
+ * mnt_unhold_writers - stop preventing write access to the given mount
+ * @mnt: mnt to stop preventing write access to
+ *
+ * Stop preventing write access to @mnt allowing callers to gain write access
+ * to @mnt again.
+ *
+ * This function can only be called after a successful call to
+ * mnt_hold_writers().
+ *
+ * Context: This function expects lock_mount_hash() to be held.
+ */
 static inline void mnt_unhold_writers(struct mount *mnt)
 {
 	/*


More information about the Devel mailing list