diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2023-06-23 16:58:19 -0700 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-06-23 16:58:19 -0700 |
commit | 63773d2b593d86440c3b96fd300ed80d00cd06ef (patch) | |
tree | ebc7b1e8f1c0ce535ef9c6120209d0e87d8d4b16 /fs/nilfs2/sufile.c | |
parent | cf01724e2d73a90524450e3dd8798cfb9d7aca05 (diff) | |
parent | 814bc1de03ea4361101408e63a68e4b82aef22cb (diff) |
Merge mm-hotfixes-stable into mm-stable to pick up depended-upon changes.
Diffstat (limited to 'fs/nilfs2/sufile.c')
-rw-r--r-- | fs/nilfs2/sufile.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c index dc359b56fdfa..2c6078a6b8ec 100644 --- a/fs/nilfs2/sufile.c +++ b/fs/nilfs2/sufile.c @@ -779,6 +779,15 @@ int nilfs_sufile_resize(struct inode *sufile, __u64 newnsegs) goto out_header; sui->ncleansegs -= nsegs - newnsegs; + + /* + * If the sufile is successfully truncated, immediately adjust + * the segment allocation space while locking the semaphore + * "mi_sem" so that nilfs_sufile_alloc() never allocates + * segments in the truncated space. + */ + sui->allocmax = newnsegs - 1; + sui->allocmin = 0; } kaddr = kmap_atomic(header_bh->b_page); |