From 033d2ab41b292fdb00bf283502b48ef8340179af Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 26 May 2009 16:54:05 -0700 Subject: [PATCH] Apply STABLE14-background-fsync-consistency-issues-20090522 * Apply upstream CVS deltas: - STABLE14-background-fsync-consistency-issues-20090522: file descriptor handling fixes for the file server. --- debian/changelog | 2 ++ src/vol/ihandle.c | 32 ++++++++++++++++++++++++++++---- src/vol/vnode.c | 3 +-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 700633d57..c78d2808b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ openafs (1.4.10+dfsg1-2) UNRELEASED; urgency=low flag setting and locking around recursive mmap protection. - STABLE14-memcache-write-on-laststore-20090512: write back dirty pages on last store with memcache to avoid losing changes. + - STABLE14-background-fsync-consistency-issues-20090522: file + descriptor handling fixes for the file server. * Provide an openafs-modules-dkms package that uses DKMS to dynamically build kernel modules for the local kernel and document this option in README.modules. This is an alternative to installing diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index c3ae3ce19..80c00f71c 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -15,7 +15,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/vol/ihandle.c,v 1.18.2.6 2008/10/27 23:54:12 shadow Exp $"); + ("$Header: /cvs/openafs/src/vol/ihandle.c,v 1.18.2.7 2009/05/22 16:00:46 shadow Exp $"); #include #include @@ -803,10 +803,32 @@ ih_reallyclose(IHandle_t * ihP) return 0; IH_LOCK; + ihP->ih_refcnt++; /* must not disappear over unlock */ + if (ihP->ih_synced) { + FdHandle_t *fdP; + IH_UNLOCK; + + fdP = IH_OPEN(ihP); + if (fdP) { + OS_SYNC(fdP->fd_fd); + FDH_CLOSE(fdP); + } + + IH_LOCK; + } + assert(ihP->ih_refcnt > 0); + ihP->ih_synced = 0; + ih_fdclose(ihP); - IH_UNLOCK; + if (ihP->ih_refcnt > 1) { + ihP->ih_refcnt--; + IH_UNLOCK; + } else { + IH_UNLOCK; + ih_release(ihP); + } return 0; } @@ -884,8 +906,10 @@ ih_sync_all() { IH_UNLOCK; fdP = IH_OPEN(ihP); - if (fdP) OS_SYNC(fdP->fd_fd); - FDH_CLOSE(fdP); + if (fdP) { + OS_SYNC(fdP->fd_fd); + FDH_CLOSE(fdP); + } IH_LOCK; } diff --git a/src/vol/vnode.c b/src/vol/vnode.c index 643b0f7e5..e5ad07f8d 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -17,7 +17,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/vol/vnode.c,v 1.19.2.7 2009/02/17 04:37:59 shadow Exp $"); + ("$Header: /cvs/openafs/src/vol/vnode.c,v 1.19.2.8 2009/05/22 16:00:46 shadow Exp $"); #include #include @@ -959,7 +959,6 @@ VCloseVnodeFiles_r(Volume * vp) for (vnp = VnodeHashTable[i]; vnp; vnp = vnp->hashNext) { if (vnp->volumePtr == vp) { IH_REALLYCLOSE(vnp->handle); - IH_RELEASE(vnp->handle); } } } -- 2.39.5