svn commit: r338902 - stable/11/sys/ufs/ufs
Konstantin Belousov
kib at FreeBSD.org
Mon Sep 24 10:03:38 UTC 2018
Author: kib
Date: Mon Sep 24 10:03:37 2018
New Revision: 338902
URL: https://svnweb.freebsd.org/changeset/base/338902
Log:
MFC r338733:
Do not upgrade the vnode lock to call getinoquota().
Modified:
stable/11/sys/ufs/ufs/ufs_vnops.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- stable/11/sys/ufs/ufs/ufs_vnops.c Mon Sep 24 09:57:47 2018 (r338901)
+++ stable/11/sys/ufs/ufs/ufs_vnops.c Mon Sep 24 10:03:37 2018 (r338902)
@@ -323,9 +323,6 @@ ufs_accessx(ap)
struct inode *ip = VTOI(vp);
accmode_t accmode = ap->a_accmode;
int error;
-#ifdef QUOTA
- int relocked;
-#endif
#ifdef UFS_ACL
struct acl *acl;
acl_type_t type;
@@ -348,32 +345,14 @@ ufs_accessx(ap)
* Inode is accounted in the quotas only if struct
* dquot is attached to it. VOP_ACCESS() is called
* from vn_open_cred() and provides a convenient
- * point to call getinoquota().
+ * point to call getinoquota(). The lock mode is
+ * exclusive when the file is opening for write.
*/
- if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
-
- /*
- * Upgrade vnode lock, since getinoquota()
- * requires exclusive lock to modify inode.
- */
- relocked = 1;
- vhold(vp);
- vn_lock(vp, LK_UPGRADE | LK_RETRY);
- VI_LOCK(vp);
- if (vp->v_iflag & VI_DOOMED) {
- vdropl(vp);
- error = ENOENT;
- goto relock;
- }
- vdropl(vp);
- } else
- relocked = 0;
- error = getinoquota(ip);
-relock:
- if (relocked)
- vn_lock(vp, LK_DOWNGRADE | LK_RETRY);
- if (error != 0)
- return (error);
+ if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) {
+ error = getinoquota(ip);
+ if (error != 0)
+ return (error);
+ }
#endif
break;
default:
More information about the svn-src-all
mailing list