From: Andrew Morton <akpm@osdl.org>
To: Valdis.Kletnieks@vt.edu
Cc: linux-kernel@vger.kernel.org, Andreas Gruenbacher <agruen@suse.de>
Subject: Re: 2.6.0-test4-mm3.1 oops with ext3 extended attributes on R/O filesystem
Date: Sat, 30 Aug 2003 21:47:51 -0700 [thread overview]
Message-ID: <20030830214751.5baaab4c.akpm@osdl.org> (raw)
In-Reply-To: <200308310412.h7V4Cxd7013786@turing-police.cc.vt.edu>
Valdis.Kletnieks@vt.edu wrote:
>
> Working on installing SELINUX, and I get to the part where all the file labels
> get added. Unfortunately, I had some file systems mounted R/O (intentionally,
> forgot to mount them R/W for this). The ext3 code upchucked while trying
> to set extended attributes on the filesystem it couldn't write to.
Thanks. It's a very straightforward bug; I'll fix it with the below patch.
A wider question is whether we should have got this far into the filesystem
code if the fs is mounted read-only. A check right up at the VFS
setxattr() level might make sense.
Regardless of that, this fix is needed because journal_start() could fail
for other reasons.
diff -puN fs/ext3/xattr.c~ext3-xattr-oops-fix fs/ext3/xattr.c
--- 25/fs/ext3/xattr.c~ext3-xattr-oops-fix 2003-08-30 21:41:24.000000000 -0700
+++ 25-akpm/fs/ext3/xattr.c 2003-08-30 21:42:41.000000000 -0700
@@ -873,17 +873,22 @@ ext3_xattr_set(struct inode *inode, int
const void *value, size_t value_len, int flags)
{
handle_t *handle;
- int error, error2;
+ int error;
handle = ext3_journal_start(inode, EXT3_DATA_TRANS_BLOCKS);
- if (IS_ERR(handle))
+ if (IS_ERR(handle)) {
error = PTR_ERR(handle);
- else
+ } else {
+ int error2;
+
error = ext3_xattr_set_handle(handle, inode, name_index, name,
value, value_len, flags);
- error2 = ext3_journal_stop(handle);
+ error2 = ext3_journal_stop(handle);
+ if (error == 0)
+ error = error2;
+ }
- return error ? error : error2;
+ return error;
}
/*
_
next prev parent reply other threads:[~2003-08-31 4:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-31 4:12 2.6.0-test4-mm3.1 oops with ext3 extended attributes on R/O filesystem Valdis.Kletnieks
2003-08-31 4:47 ` Andrew Morton [this message]
2003-08-31 11:19 ` Andreas Gruenbacher
2003-08-31 14:24 ` Valdis.Kletnieks
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=20030830214751.5baaab4c.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=Valdis.Kletnieks@vt.edu \
--cc=agruen@suse.de \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox