Add operation fstrans_held(struct mount *), true if the current thread
holds a fstrans lock. Ride 9.99.61
This commit is contained in:
parent
feb45d8f30
commit
a1b51d3577
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: vfs_trans.c,v 1.61 2019/06/17 08:07:27 hannken Exp $ */
|
/* $NetBSD: vfs_trans.c,v 1.62 2020/05/13 09:21:30 hannken Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.61 2019/06/17 08:07:27 hannken Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.62 2020/05/13 09:21:30 hannken Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* File system transaction operations.
|
* File system transaction operations.
|
||||||
@ -568,6 +568,23 @@ fstrans_done(struct mount *mp)
|
|||||||
mutex_exit(&fstrans_lock);
|
mutex_exit(&fstrans_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if we hold an lock.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
fstrans_held(struct mount *mp)
|
||||||
|
{
|
||||||
|
struct fstrans_lwp_info *fli;
|
||||||
|
struct fstrans_mount_info *fmi;
|
||||||
|
|
||||||
|
KASSERT(mp != dead_rootmount);
|
||||||
|
|
||||||
|
fli = fstrans_get_lwp_info(mp, true);
|
||||||
|
fmi = fli->fli_mountinfo;
|
||||||
|
|
||||||
|
return (fli->fli_trans_cnt > 0 || fmi->fmi_owner == curlwp);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if this thread has an exclusive lock.
|
* Check if this thread has an exclusive lock.
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: fstrans.h,v 1.13 2019/03/01 09:02:03 hannken Exp $ */
|
/* $NetBSD: fstrans.h,v 1.14 2020/05/13 09:21:30 hannken Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
@ -53,6 +53,7 @@ void fstrans_start(struct mount *);
|
|||||||
int fstrans_start_nowait(struct mount *);
|
int fstrans_start_nowait(struct mount *);
|
||||||
void fstrans_start_lazy(struct mount *);
|
void fstrans_start_lazy(struct mount *);
|
||||||
void fstrans_done(struct mount *);
|
void fstrans_done(struct mount *);
|
||||||
|
int fstrans_held(struct mount *);
|
||||||
int fstrans_is_owner(struct mount *);
|
int fstrans_is_owner(struct mount *);
|
||||||
int fstrans_mount(struct mount *);
|
int fstrans_mount(struct mount *);
|
||||||
void fstrans_unmount(struct mount *);
|
void fstrans_unmount(struct mount *);
|
||||||
|
Loading…
Reference in New Issue
Block a user