hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/fs/nilfs2/sufile.c
....@@ -779,6 +779,15 @@
779779 goto out_header;
780780
781781 sui->ncleansegs -= nsegs - newnsegs;
782
+
783
+ /*
784
+ * If the sufile is successfully truncated, immediately adjust
785
+ * the segment allocation space while locking the semaphore
786
+ * "mi_sem" so that nilfs_sufile_alloc() never allocates
787
+ * segments in the truncated space.
788
+ */
789
+ sui->allocmax = newnsegs - 1;
790
+ sui->allocmin = 0;
782791 }
783792
784793 kaddr = kmap_atomic(header_bh->b_page);