diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2023-01-19 20:05:43 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2023-01-19 23:24:42 -0500 |
commit | abb7c742397324f8676c5b622effdce911cd52e3 (patch) | |
tree | 7ed6e6848e00b5e2d5f1e826b3752374f2a44933 /fs/sysv/dir.c | |
parent | 83005276d383387fec7e18c7a36daade579a23a7 (diff) |
sysv: fix handling of delete_entry and set_link failures
similar to minixfs series - make sysv_set_link() report failures,
lift dir_put_page() into the callers of sysv_set_link() and
sysv_delete_entry(), make sysv_rename() handle failures in both.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/sysv/dir.c')
-rw-r--r-- | fs/sysv/dir.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index 3ed98d66b152..999bceb99974 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c @@ -249,10 +249,12 @@ int sysv_delete_entry(struct sysv_dir_entry *de, struct page *page) lock_page(page); err = sysv_prepare_chunk(page, pos, SYSV_DIRSIZE); - BUG_ON(err); + if (err) { + unlock_page(page); + return err; + } de->inode = 0; dir_commit_chunk(page, pos, SYSV_DIRSIZE); - dir_put_page(page, de); inode->i_ctime = inode->i_mtime = current_time(inode); mark_inode_dirty(inode); return sysv_handle_dirsync(inode); @@ -335,7 +337,7 @@ not_empty: } /* Releases the page */ -void sysv_set_link(struct sysv_dir_entry *de, struct page *page, +int sysv_set_link(struct sysv_dir_entry *de, struct page *page, struct inode *inode) { struct inode *dir = page->mapping->host; @@ -344,13 +346,15 @@ void sysv_set_link(struct sysv_dir_entry *de, struct page *page, lock_page(page); err = sysv_prepare_chunk(page, pos, SYSV_DIRSIZE); - BUG_ON(err); + if (err) { + unlock_page(page); + return err; + } de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino); dir_commit_chunk(page, pos, SYSV_DIRSIZE); - dir_put_page(page, de); dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty(dir); - sysv_handle_dirsync(inode); + return sysv_handle_dirsync(inode); } /* |