All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>
Subject: [PATCH 1/7] udf: Handle error when expanding directory
Date: Thu, 22 Dec 2022 11:15:58 +0100	[thread overview]
Message-ID: <20221222101612.18814-1-jack@suse.cz> (raw)
In-Reply-To: <20221222101300.12679-1-jack@suse.cz>

When there is an error when adding extent to the directory to expand it,
make sure to propagate the error up properly. This is not expected to
happen currently but let's make the code more futureproof.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/udf/namei.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 800271b00f84..de169feacce9 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -192,8 +192,13 @@ static struct buffer_head *udf_expand_dir_adinicb(struct inode *inode,
 	epos.bh = NULL;
 	epos.block = iinfo->i_location;
 	epos.offset = udf_file_entry_alloc_offset(inode);
-	udf_add_aext(inode, &epos, &eloc, inode->i_size, 0);
+	ret = udf_add_aext(inode, &epos, &eloc, inode->i_size, 0);
 	brelse(epos.bh);
+	if (ret < 0) {
+		*err = ret;
+		udf_free_blocks(inode->i_sb, inode, &eloc, 0, 1);
+		return NULL;
+	}
 	mark_inode_dirty(inode);
 
 	/* Now fixup tags in moved directory entries */
-- 
2.35.3


  reply	other threads:[~2022-12-22 10:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 10:15 [PATCH 0/7] udf: Couple more fixes for extent and directory handling Jan Kara
2022-12-22 10:15 ` Jan Kara [this message]
2022-12-22 10:15 ` [PATCH 2/7] udf: Handle error when adding extent to symlink Jan Kara
2022-12-22 10:16 ` [PATCH 3/7] udf: Handle error when adding extent to a file Jan Kara
2022-12-26  4:28   ` Nathan Chancellor
2023-01-02 12:51     ` Jan Kara
2022-12-22 10:16 ` [PATCH 4/7] udf: Allocate name buffer in directory iterator on heap Jan Kara
2022-12-22 10:16 ` [PATCH 5/7] udf: Move setting of i_lenExtents into udf_do_extend_file() Jan Kara
2022-12-22 10:16 ` [PATCH 6/7] udf: Fix extension of the last extent in the file Jan Kara
2022-12-22 10:16 ` [PATCH 7/7] udf: Keep i_lenExtents consistent with the total length of extents Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221222101612.18814-1-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.