lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1417154411-5367-4-git-send-email-tytso@mit.edu>
Date:	Fri, 28 Nov 2014 01:00:08 -0500
From:	Theodore Ts'o <tytso@....edu>
To:	Ext4 Developers List <linux-ext4@...r.kernel.org>
Cc:	Linux Filesystem Development List <linux-fsdevel@...r.kernel.org>,
	Theodore Ts'o <tytso@....edu>
Subject: [PATCH 2/5] vfs: use writeback lists to provide lazytime one day timeout

Queue inodes with dirty timestamps for writeback 24 hours after they
were initially dirtied.

Signed-off-by: Theodore Ts'o <tytso@....edu>
---
 fs/fs-writeback.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 3d562e2..bd76590 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -253,7 +253,7 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t)
  */
 static int move_expired_inodes(struct list_head *delaying_queue,
 			       struct list_head *dispatch_queue,
-			       struct wb_writeback_work *work)
+			       unsigned long *older_than_this)
 {
 	LIST_HEAD(tmp);
 	struct list_head *pos, *node;
@@ -264,8 +264,8 @@ static int move_expired_inodes(struct list_head *delaying_queue,
 
 	while (!list_empty(delaying_queue)) {
 		inode = wb_inode(delaying_queue->prev);
-		if (work->older_than_this &&
-		    inode_dirtied_after(inode, *work->older_than_this))
+		if (older_than_this &&
+		    inode_dirtied_after(inode, *older_than_this))
 			break;
 		list_move(&inode->i_wb_list, &tmp);
 		moved++;
@@ -309,9 +309,14 @@ out:
 static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work)
 {
 	int moved;
+	unsigned long one_day_later = jiffies + (HZ * 86400);
+
 	assert_spin_locked(&wb->list_lock);
 	list_splice_init(&wb->b_more_io, &wb->b_io);
-	moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, work);
+	moved = move_expired_inodes(&wb->b_dirty, &wb->b_io,
+				    work->older_than_this);
+	moved += move_expired_inodes(&wb->b_dirty_time, &wb->b_io,
+				     &one_day_later);
 	trace_writeback_queue_io(wb, work, moved);
 }
 
@@ -679,6 +684,17 @@ static long writeback_sb_inodes(struct super_block *sb,
 		inode->i_state |= I_SYNC;
 		spin_unlock(&inode->i_lock);
 
+		/*
+		 * If the inode is marked dirty time but is not dirty,
+		 * then at last for ext3 and ext4 we need to call
+		 * mark_inode_dirty_sync in order to get the inode
+		 * timestamp transferred to the on disk inode, since
+		 * write_inode is a no-op for those file systems.
+		 */
+		if ((inode->i_state & I_DIRTY_TIME) &&
+		    ((inode->i_state & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) == 0))
+			mark_inode_dirty_sync(inode);
+
 		write_chunk = writeback_chunk_size(wb->bdi, work);
 		wbc.nr_to_write = write_chunk;
 		wbc.pages_skipped = 0;
@@ -1237,9 +1253,10 @@ void inode_requeue_dirtytime(struct inode *inode)
 	spin_lock(&bdi->wb.list_lock);
 	spin_lock(&inode->i_lock);
 	if ((inode->i_state & I_DIRTY_WB) == 0) {
-		if (inode->i_state & I_DIRTY_TIME)
+		if (inode->i_state & I_DIRTY_TIME) {
+			inode->dirtied_when = jiffies;
 			list_move(&inode->i_wb_list, &bdi->wb.b_dirty_time);
-		else
+		} else
 			list_del_init(&inode->i_wb_list);
 	}
 	spin_unlock(&inode->i_lock);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ