user/dev discussion of public-inbox itself
 help / color / Atom feed
* [PATCH] xapcmd: delay over->check_inodes trigger
@ 2020-07-05 21:51 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-07-05 21:51 UTC (permalink / raw)
  To: meta

We must not trigger wakeups on InboxIdle users until after we've
renamed all files into place.  Otherwise, the InboxIdle caller
may just reopen the old (soon-to-be-unlinked) file.

This fixes occasional test failures in t/nntpd.t

Fixes: f977826a17f8735e ("lock: reduce inotify wakeups")
---
 lib/PublicInbox/Xapcmd.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm
index 784140416..a57fa5597 100644
--- a/lib/PublicInbox/Xapcmd.pm
+++ b/lib/PublicInbox/Xapcmd.pm
@@ -23,6 +23,7 @@ sub commit_changes ($$$$) {
 
 	$SIG{INT} or die 'BUG: $SIG{INT} not handled';
 	my @old_shard;
+	my $over_chg;
 
 	while (my ($old, $newdir) = each %$tmp) {
 		next if $old eq ''; # no invalid paths
@@ -39,7 +40,7 @@ sub commit_changes ($$$$) {
 			my $tmp_over = "$new/over.sqlite3";
 			$over->connect->sqlite_backup_to_file($tmp_over);
 			$over = undef;
-			syswrite($im->{lockfh}, '.'); # trigger ->check_inodes
+			$over_chg = 1;
 		}
 
 		if (!defined($new)) { # culled shard
@@ -60,6 +61,10 @@ sub commit_changes ($$$$) {
 				die "failed to remove $prev: $!\n";
 		}
 	}
+
+	# trigger ->check_inodes in read-only daemons
+	syswrite($im->{lockfh}, '.') if $over_chg;
+
 	remove_tree(@old_shard);
 	$tmp = undef;
 	if (!$opt->{-coarse_lock}) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-05 21:51 [PATCH] xapcmd: delay over->check_inodes trigger Eric Wong

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git