[XFS] Fixes the leak in reservation space because we weren't ungranting
authorTim Shimmin <tes@sgi.com>
Thu, 28 Sep 2006 01:04:16 +0000 (11:04 +1000)
committerTim Shimmin <tes@sgi.com>
Thu, 28 Sep 2006 01:04:16 +0000 (11:04 +1000)
space for the unmount record - which becomes a problem in the freeze/thaw
scenario.

SGI-PV: 942533
SGI-Modid: xfs-linux-melb:xfs-kern:26815a

Signed-off-by: Tim Shimmin <tes@sgi.com>
fs/xfs/xfs_log.c
fs/xfs/xfs_log_priv.h

index ac999789a44d97c9e51709b8990fccfbd71ac88b..c48bf61f17bd847cdb04a6ca8ad6b6f9f8c7e273 100644 (file)
@@ -617,7 +617,8 @@ xfs_log_unmount_write(xfs_mount_t *mp)
                reg[0].i_len  = sizeof(magic);
                XLOG_VEC_SET_TYPE(&reg[0], XLOG_REG_TYPE_UNMOUNT);
 
-               error = xfs_log_reserve(mp, 600, 1, &tic, XFS_LOG, 0, 0);
+               error = xfs_log_reserve(mp, 600, 1, &tic,
+                                       XFS_LOG, 0, XLOG_UNMOUNT_REC_TYPE);
                if (!error) {
                        /* remove inited flag */
                        ((xlog_ticket_t *)tic)->t_flags = 0;
@@ -655,8 +656,11 @@ xfs_log_unmount_write(xfs_mount_t *mp)
                } else {
                        LOG_UNLOCK(log, s);
                }
-               if (tic)
+               if (tic) {
+                       xlog_trace_loggrant(log, tic, "unmount rec");
+                       xlog_ungrant_log_space(log, tic);
                        xlog_state_put_ticket(log, tic);
+               }
        } else {
                /*
                 * We're already in forced_shutdown mode, couldn't
index 7bf5046d8d28eab308f4ea6d87bb53d059f5b794..9bd3cdf11a87068db1b773b5afabb2ea0a5bc913 100644 (file)
@@ -502,6 +502,12 @@ extern int  xlog_bread(xlog_t *, xfs_daddr_t, int, struct xfs_buf *);
 #define XLOG_TRACE_SLEEP_FLUSH 3
 #define XLOG_TRACE_WAKE_FLUSH  4
 
+/*
+ * Unmount record type is used as a pseudo transaction type for the ticket.
+ * It's value must be outside the range of XFS_TRANS_* values.
+ */
+#define XLOG_UNMOUNT_REC_TYPE  (-1U)
+
 #endif /* __KERNEL__ */
 
 #endif /* __XFS_LOG_PRIV_H__ */