From a046da7e90052bb30679ae1f0f1c3187d7a5aaee Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Thu, 6 Apr 2017 12:44:34 +0000 Subject: [PATCH] Remove spl*() calls from the nfsclient code. Style adjustments in the related lines in ncl_writebp(). Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/fs/nfsclient/nfs_clbio.c | 4 ---- sys/fs/nfsclient/nfs_clvfsops.c | 9 --------- sys/fs/nfsclient/nfs_clvnops.c | 32 ++++++++++---------------------- 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 083da69bbc0..df3aea9681b 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -1811,9 +1811,6 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td, */ if (error == EINTR || error == EIO || error == ETIMEDOUT || (!error && (bp->b_flags & B_NEEDCOMMIT))) { - int s; - - s = splbio(); bp->b_flags &= ~(B_INVAL|B_NOCACHE); if ((bp->b_flags & B_PAGING) == 0) { bdirty(bp); @@ -1822,7 +1819,6 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td, if ((error == EINTR || error == ETIMEDOUT) && (bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; - splx(s); } else { if (error) { bp->b_ioflags |= BIO_ERROR; diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 7c460c5355a..0698c2d1b34 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -414,11 +414,6 @@ nfs_mountroot(struct mount *mp) if (nfs_diskless_valid == 1) nfs_convert_diskless(); - /* - * XXX splnet, so networks will receive... - */ - splnet(); - /* * Do enough of ifconfig(8) so that the critical net interface can * talk to the server. @@ -558,12 +553,9 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, const char *hostname, struct ucred *cred, struct thread *td) { - int s; int adjsock; char *p; - s = splnet(); - /* * Set read-only flag if requested; otherwise, clear it if this is * an update. If this is not an update, then either the read-only @@ -609,7 +601,6 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, /* Update flags atomically. Don't change the lock bits. */ nmp->nm_flag = argp->flags | nmp->nm_flag; - splx(s); if ((argp->flags & NFSMNT_TIMEO) && argp->timeo > 0) { nmp->nm_timeo = (argp->timeo * NFS_HZ + 5) / 10; diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 672730d0c91..30227ff82a5 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3167,27 +3167,21 @@ nfs_print(struct vop_print_args *ap) int ncl_writebp(struct buf *bp, int force __unused, struct thread *td) { - int s; - int oldflags = bp->b_flags; -#if 0 - int retv = 1; - off_t off; -#endif + int oldflags, rtval; BUF_ASSERT_HELD(bp); if (bp->b_flags & B_INVAL) { brelse(bp); - return(0); + return (0); } + oldflags = bp->b_flags; bp->b_flags |= B_CACHE; /* * Undirty the bp. We will redirty it later if the I/O fails. */ - - s = splbio(); bundirty(bp); bp->b_flags &= ~B_DONE; bp->b_ioflags &= ~BIO_ERROR; @@ -3195,7 +3189,6 @@ ncl_writebp(struct buf *bp, int force __unused, struct thread *td) bufobj_wref(bp->b_bufobj); curthread->td_ru.ru_oublock++; - splx(s); /* * Note: to avoid loopback deadlocks, we do not @@ -3207,19 +3200,14 @@ ncl_writebp(struct buf *bp, int force __unused, struct thread *td) bp->b_iooffset = dbtob(bp->b_blkno); bstrategy(bp); - if( (oldflags & B_ASYNC) == 0) { - int rtval = bufwait(bp); + if ((oldflags & B_ASYNC) != 0) + return (0); - if (oldflags & B_DELWRI) { - s = splbio(); - reassignbuf(bp); - splx(s); - } - brelse(bp); - return (rtval); - } - - return (0); + rtval = bufwait(bp); + if (oldflags & B_DELWRI) + reassignbuf(bp); + brelse(bp); + return (rtval); } /*