]> git.hungrycats.org Git - linux/commitdiff
[XFS] DMAPI deadlock prevention when interacting with the IO path.
authorDean Roehrich <roehrich@sgi.com>
Wed, 3 Mar 2004 03:35:48 +0000 (14:35 +1100)
committerNathan Scott <nathans@sgi.com>
Wed, 3 Mar 2004 03:35:48 +0000 (14:35 +1100)
SGI Modid: xfs-linux:xfs-kern:167547a

fs/xfs/linux/xfs_lrw.c
fs/xfs/xfs_dmapi.h
fs/xfs/xfs_vnodeops.c

index d04855e7090c484928135fe5f19fc6e7af001e76..ac01541dfc921697d6cdd0c59bc0c7ac62964b8c 100644 (file)
@@ -730,7 +730,7 @@ start:
        if ((DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_WRITE) &&
            !(ioflags & IO_INVIS) && !eventsent)) {
                loff_t          savedsize = *offset;
-               int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG(ioflags);
+               int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
 
                xfs_iunlock(xip, XFS_ILOCK_EXCL);
                error = XFS_SEND_DATA(xip->i_mount, DM_EVENT_WRITE, vp,
index 43a72d58a9376b3e107ca6557a8ace5a3f6e58ca..53838b48b7d8d1c410a03cc3880e0f929fc2d49e 100644 (file)
@@ -169,19 +169,22 @@ typedef enum {
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21)
 /* i_alloc_sem was added in 2.4.22-pre1 */
-#define DM_FLAGS_IALLOCSEM     0x010   /* thread holds i_alloc_sem */
+#define DM_FLAGS_IALLOCSEM_RD  0x010   /* thread holds i_alloc_sem rd */
+#define DM_FLAGS_IALLOCSEM_WR  0x020   /* thread holds i_alloc_sem wr */
 #endif
 #endif
 
 /*
  *     Based on IO_ISDIRECT, decide which i_ flag is set.
  */
-#ifdef DM_FLAGS_IALLOCSEM
-#define DM_SEM_FLAG(ioflags) (((ioflags) & IO_ISDIRECT) ? \
-                             DM_FLAGS_IALLOCSEM : DM_FLAGS_ISEM)
+#ifdef DM_FLAGS_IALLOCSEM_RD
+#define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \
+                             DM_FLAGS_IALLOCSEM_RD : DM_FLAGS_ISEM)
+#define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM)
 #else
-#define DM_SEM_FLAG(ioflags) (((ioflags) & IO_ISDIRECT) ? \
+#define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \
                              0 : DM_FLAGS_ISEM)
+#define DM_SEM_FLAG_WR (DM_FLAGS_ISEM)
 #endif
 
 /*
index 3e283bbf8a6462b54887738b7ccd3ef9917c5849..6440404fbca23a3335954ce3014e21bcc934ef5c 100644 (file)
@@ -413,8 +413,9 @@ xfs_setattr(
        } else {
                if (DM_EVENT_ENABLED (vp->v_vfsp, ip, DM_EVENT_TRUNCATE) &&
                    !(flags & ATTR_DMI)) {
+                       int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR;
                        code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, vp,
-                               vap->va_size, 0, AT_DELAY_FLAG(flags), NULL);
+                               vap->va_size, 0, dmflags, NULL);
                        if (code) {
                                lock_flags = 0;
                                goto error_return;