{
struct inode *ip = AFSTOV(avc);
+ if (!avc->states & CPageWrite)
+ avc->states |= CPageWrite;
+ else
+ return; /* someone already writing */
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,5)
/* filemap_fdatasync() only exported in 2.4.5 and above */
ReleaseWriteLock(&avc->lock);
AFS_GLOCK();
ObtainWriteLock(&avc->lock, 121);
#endif
+ avc->states &= ~CPageWrite;
}
/* Purge VM for a file when its callback is revoked.
ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
ICL_TYPE_INT32, 99999);
+ ObtainReadLock(&vcp->lock);
+ if (vcp->states & CPageWrite) {
+ ReleaseReadLock(&vcp->lock);
+ AFS_GUNLOCK();
+ maybe_unlock_kernel();
+ crfree(credp);
+ kunmap(pp);
+#if defined(WRITEPAGE_ACTIVATE)
+ return WRITEPAGE_ACTIVATE;
+#else
+ return AOP_WRITEPAGE_ACTIVATE;
+#endif
+ }
+ ReleaseReadLock(&vcp->lock);
+
setup_uio(&tuio, &iovec, buffer, base, count, UIO_WRITE, AFS_UIOSYS);
code = afs_write(vcp, &tuio, f_flags, credp, 0);
#define CUnlinkedDel 0x00040000
#define CVFlushed 0x00080000
#define CCore1 0x00100000 /* osf1 core file; not same as CCore above */
+#ifdef AFS_LINUX22_ENV
+#define CPageWrite 0x00200000 /* to detect vm deadlock - linux */
+#else
#define CWritingUFS 0x00200000 /* to detect vm deadlock - used by sgi */
+#endif
#define CCreating 0x00400000 /* avoid needless store after open truncate */
#define CPageHog 0x00800000 /* AIX - dumping large cores is a page hog. */
#define CDCLock 0x02000000 /* Vnode lock held over call to GetDownD */