* Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs
[not found] <20071011213126.cf92efb7.akpm@linux-foundation.org>
@ 2007-10-14 22:34 ` Laurent Riffard
2007-10-15 8:40 ` Christoph Hellwig
0 siblings, 1 reply; 9+ messages in thread
From: Laurent Riffard @ 2007-10-14 22:34 UTC (permalink / raw)
To: Andrew Morton, Dave Hansen; +Cc: linux-kernel, linux-fsdevel, reiserfs-devel
Le 12.10.2007 06:31, Andrew Morton a écrit :
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.23/2.6.23-mm1/
/home is mounted with the following options:
/dev/mapper/vglinux1-lvhome on /home type reiserfs (rw,noatime,nodiratime,user_xattr)
I guess that beagled (the Beagle desktop search daemon) has populated user
xattrs on almost all files. Now, when I delete a file, two BUGs occur
and the system hangs. Here is the stack for the first BUG (the second
one is very similar):
[partially hand copied stack]
_fput
fput
reiserfs_delete_xattrs
reiserfs_delete_inode
generic_delete_inode
generic_drop_inode
iput
do_unlinkat
sys_unlink
sys_enter_past_esp
I reported a similar BUG in 2.6.22-rc8-mm2 (see
http://lkml.org/lkml/2007/9/27/235). Dave Hansen sent a patch for it, I
tested it and it was OK for 2.6.22-rc8-mm2.
I tried this patch on 2.6.23-mm1, and it fixed the BUGs here too.
----
From: Dave Hansen <haveblue@us.ibm.com>
The bug is caused by reiserfs creating a special 'struct file' with a
NULL vfsmount.
/* Opens a file pointer to the attribute associated with inode */
static struct file *open_xa_file(const struct inode *inode, const char
*name,
int flags)
{
...
fp = dentry_open(xafile, NULL, O_RDWR);
/* dentry_open dputs the dentry if it fails */
As Christoph just said, this is somewhat of a bandaid. But, it
shouldn't hurt anything.
---
lxc-dave/fs/file_table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN fs/open.c~fix-reiserfs-oops fs/open.c
diff -puN fs/file_table.c~fix-reiserfs-oops fs/file_table.c
--- lxc/fs/file_table.c~fix-reiserfs-oops 2007-09-27 13:32:20.000000000 -0700
+++ lxc-dave/fs/file_table.c 2007-09-27 13:33:11.000000000 -0700
@@ -236,7 +236,7 @@ void fastcall __fput(struct file *file)
fops_put(file->f_op);
if (file->f_mode & FMODE_WRITE) {
put_write_access(inode);
- if (!special_file(inode->i_mode))
+ if (!special_file(inode->i_mode) && mnt)
mnt_drop_write(mnt);
}
put_pid(file->f_owner.pid);
diff -puN include/linux/mount.h~fix-reiserfs-oops include/linux/mount.h
_
-
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs
2007-10-14 22:34 ` 2.6.23-mm1: BUG in reiserfs_delete_xattrs Laurent Riffard
@ 2007-10-15 8:40 ` Christoph Hellwig
2007-10-15 18:31 ` Jeff Mahoney
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Christoph Hellwig @ 2007-10-15 8:40 UTC (permalink / raw)
To: Laurent Riffard
Cc: Andrew Morton, Dave Hansen, linux-kernel, linux-fsdevel,
reiserfs-devel
On Mon, Oct 15, 2007 at 12:34:58AM +0200, Laurent Riffard wrote:
> reiserfs_delete_xattrs
> reiserfs_delete_inode
> generic_delete_inode
> generic_drop_inode
> iput
> do_unlinkat
> sys_unlink
> sys_enter_past_esp
>
> I reported a similar BUG in 2.6.22-rc8-mm2 (see
> http://lkml.org/lkml/2007/9/27/235). Dave Hansen sent a patch for it, I
> tested it and it was OK for 2.6.22-rc8-mm2.
>
> I tried this patch on 2.6.23-mm1, and it fixed the BUGs here too.
The delete path is a similar case as the one Dave fixed, also cause by
a NULL vfsmount passed to dentry_open, but through a different code-path.
Untested fix for this problem below:
Index: linux-2.6.23-rc8/fs/reiserfs/xattr.c
===================================================================
--- linux-2.6.23-rc8.orig/fs/reiserfs/xattr.c 2007-09-30 14:13:46.000000000 +0200
+++ linux-2.6.23-rc8/fs/reiserfs/xattr.c 2007-09-30 14:18:30.000000000 +0200
@@ -207,9 +207,8 @@ static struct dentry *get_xa_file_dentry
* we're called with i_mutex held, so there are no worries about the directory
* changing underneath us.
*/
-static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
+static int __xattr_readdir(struct inode *inode, void *dirent, filldir_t filldir)
{
- struct inode *inode = filp->f_path.dentry->d_inode;
struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
INITIALIZE_PATH(path_to_entry);
struct buffer_head *bh;
@@ -352,24 +351,19 @@ static int __xattr_readdir(struct file *
* this is stolen from vfs_readdir
*
*/
-static
-int xattr_readdir(struct file *file, filldir_t filler, void *buf)
+static int xattr_readdir(struct inode *inode, filldir_t filler, void *buf)
{
- struct inode *inode = file->f_path.dentry->d_inode;
int res = -ENOTDIR;
- if (!file->f_op || !file->f_op->readdir)
- goto out;
+
mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR);
-// down(&inode->i_zombie);
res = -ENOENT;
if (!IS_DEADDIR(inode)) {
lock_kernel();
- res = __xattr_readdir(file, buf, filler);
+ res = __xattr_readdir(inode, buf, filler);
unlock_kernel();
}
-// up(&inode->i_zombie);
mutex_unlock(&inode->i_mutex);
- out:
+
return res;
}
@@ -721,7 +715,6 @@ reiserfs_delete_xattrs_filler(void *buf,
/* This is called w/ inode->i_mutex downed */
int reiserfs_delete_xattrs(struct inode *inode)
{
- struct file *fp;
struct dentry *dir, *root;
int err = 0;
@@ -742,15 +735,8 @@ int reiserfs_delete_xattrs(struct inode
return 0;
}
- fp = dentry_open(dir, NULL, O_RDWR);
- if (IS_ERR(fp)) {
- err = PTR_ERR(fp);
- /* dentry_open dputs the dentry if it fails */
- goto out;
- }
-
lock_kernel();
- err = xattr_readdir(fp, reiserfs_delete_xattrs_filler, dir);
+ err = xattr_readdir(dir->d_inode, reiserfs_delete_xattrs_filler, dir);
if (err) {
unlock_kernel();
goto out_dir;
@@ -770,7 +756,7 @@ int reiserfs_delete_xattrs(struct inode
unlock_kernel();
out_dir:
- fput(fp);
+ dput(dir);
out:
if (!err)
@@ -812,7 +798,6 @@ reiserfs_chown_xattrs_filler(void *buf,
int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
{
- struct file *fp;
struct dentry *dir;
int err = 0;
struct reiserfs_chown_buf buf;
@@ -836,13 +821,6 @@ int reiserfs_chown_xattrs(struct inode *
goto out;
}
- fp = dentry_open(dir, NULL, O_RDWR);
- if (IS_ERR(fp)) {
- err = PTR_ERR(fp);
- /* dentry_open dputs the dentry if it fails */
- goto out;
- }
-
lock_kernel();
attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME);
@@ -850,7 +828,7 @@ int reiserfs_chown_xattrs(struct inode *
buf.attrs = attrs;
buf.inode = inode;
- err = xattr_readdir(fp, reiserfs_chown_xattrs_filler, &buf);
+ err = xattr_readdir(dir->d_inode, reiserfs_chown_xattrs_filler, &buf);
if (err) {
unlock_kernel();
goto out_dir;
@@ -860,7 +838,7 @@ int reiserfs_chown_xattrs(struct inode *
unlock_kernel();
out_dir:
- fput(fp);
+ dput(dir);
out:
attrs->ia_valid = ia_valid;
@@ -1008,7 +986,6 @@ reiserfs_listxattr_filler(void *buf, con
*/
ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
{
- struct file *fp;
struct dentry *dir;
int err = 0;
struct reiserfs_listxattr_buf buf;
@@ -1031,13 +1008,6 @@ ssize_t reiserfs_listxattr(struct dentry
goto out;
}
- fp = dentry_open(dir, NULL, O_RDWR);
- if (IS_ERR(fp)) {
- err = PTR_ERR(fp);
- /* dentry_open dputs the dentry if it fails */
- goto out;
- }
-
buf.r_buf = buffer;
buf.r_size = buffer ? size : 0;
buf.r_pos = 0;
@@ -1045,7 +1015,7 @@ ssize_t reiserfs_listxattr(struct dentry
REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir;
- err = xattr_readdir(fp, reiserfs_listxattr_filler, &buf);
+ err = xattr_readdir(dir->d_inode, reiserfs_listxattr_filler, &buf);
if (err)
goto out_dir;
@@ -1055,7 +1025,7 @@ ssize_t reiserfs_listxattr(struct dentry
err = buf.r_pos;
out_dir:
- fput(fp);
+ dput(dir);
out:
reiserfs_read_unlock_xattr_i(dentry->d_inode);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs
2007-10-15 8:40 ` Christoph Hellwig
@ 2007-10-15 18:31 ` Jeff Mahoney
2007-10-15 19:51 ` Laurent Riffard
[not found] ` <4713B1E7.2010504@suse.com>
2 siblings, 0 replies; 9+ messages in thread
From: Jeff Mahoney @ 2007-10-15 18:31 UTC (permalink / raw)
To: Christoph Hellwig, Laurent Riffard, Andrew Morton, Dave Hansen,
linux-kernel
Christoph Hellwig wrote:
> On Mon, Oct 15, 2007 at 12:34:58AM +0200, Laurent Riffard wrote:
>> reiserfs_delete_xattrs
>> reiserfs_delete_inode
>> generic_delete_inode
>> generic_drop_inode
>> iput
>> do_unlinkat
>> sys_unlink
>> sys_enter_past_esp
>>
>> I reported a similar BUG in 2.6.22-rc8-mm2 (see
>> http://lkml.org/lkml/2007/9/27/235). Dave Hansen sent a patch for it, I
>> tested it and it was OK for 2.6.22-rc8-mm2.
>>
>> I tried this patch on 2.6.23-mm1, and it fixed the BUGs here too.
>
> The delete path is a similar case as the one Dave fixed, also cause by
> a NULL vfsmount passed to dentry_open, but through a different code-path.
>
> Untested fix for this problem below:
Here's a patch I worked up the other night that kills off struct file
completely from the xattr code. I've tested it locally.
After several posts and bug reports regarding interaction with the NULL
nameidata, here's a patch to clean up the mess with struct file in the
reiserfs xattr code.
As observed in several of the posts, there's really no need for struct file
to exist in the xattr code. It was really only passed around due to the
f_op->readdir() and a_ops->{prepare,commit}_write prototypes requiring it.
reiserfs_prepare_write() and reiserfs_commit_write() don't actually use
the struct file passed to it, and the xattr code uses a private version of
reiserfs_readdir() to enumerate the xattr directories.
I do have patches in my queue to convert the xattrs to use reiserfs_readdir(),
but I guess I'll just have to rework those.
This is pretty close to the patch by Dave Hansen for -mm, but I didn't
notice it until after I wrote this up.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/reiserfs/xattr.c | 111 ++++++++++++++--------------------------------------
1 file changed, 31 insertions(+), 80 deletions(-)
--- a/fs/reiserfs/xattr.c 2007-08-27 14:03:39.000000000 -0400
+++ b/fs/reiserfs/xattr.c 2007-10-14 22:11:05.000000000 -0400
@@ -191,28 +191,11 @@ static struct dentry *get_xa_file_dentry
dput(xadir);
if (err)
xafile = ERR_PTR(err);
- return xafile;
-}
-
-/* Opens a file pointer to the attribute associated with inode */
-static struct file *open_xa_file(const struct inode *inode, const char *name,
- int flags)
-{
- struct dentry *xafile;
- struct file *fp;
-
- xafile = get_xa_file_dentry(inode, name, flags);
- if (IS_ERR(xafile))
- return ERR_PTR(PTR_ERR(xafile));
else if (!xafile->d_inode) {
dput(xafile);
- return ERR_PTR(-ENODATA);
+ xafile = ERR_PTR(-ENODATA);
}
-
- fp = dentry_open(xafile, NULL, O_RDWR);
- /* dentry_open dputs the dentry if it fails */
-
- return fp;
+ return xafile;
}
/*
@@ -228,9 +211,8 @@ static struct file *open_xa_file(const s
* we're called with i_mutex held, so there are no worries about the directory
* changing underneath us.
*/
-static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
+static int __xattr_readdir(struct inode *inode, void *dirent, filldir_t filldir)
{
- struct inode *inode = filp->f_path.dentry->d_inode;
struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
INITIALIZE_PATH(path_to_entry);
struct buffer_head *bh;
@@ -374,23 +356,16 @@ static int __xattr_readdir(struct file *
*
*/
static
-int xattr_readdir(struct file *file, filldir_t filler, void *buf)
+int xattr_readdir(struct inode *inode, filldir_t filler, void *buf)
{
- struct inode *inode = file->f_path.dentry->d_inode;
- int res = -ENOTDIR;
- if (!file->f_op || !file->f_op->readdir)
- goto out;
+ int res = -ENOENT;
mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR);
-// down(&inode->i_zombie);
- res = -ENOENT;
if (!IS_DEADDIR(inode)) {
lock_kernel();
- res = __xattr_readdir(file, buf, filler);
+ res = __xattr_readdir(inode, buf, filler);
unlock_kernel();
}
-// up(&inode->i_zombie);
mutex_unlock(&inode->i_mutex);
- out:
return res;
}
@@ -436,7 +411,7 @@ reiserfs_xattr_set(struct inode *inode,
size_t buffer_size, int flags)
{
int err = 0;
- struct file *fp;
+ struct dentry *dentry;
struct page *page;
char *data;
struct address_space *mapping;
@@ -454,18 +429,18 @@ reiserfs_xattr_set(struct inode *inode,
xahash = xattr_hash(buffer, buffer_size);
open_file:
- fp = open_xa_file(inode, name, flags);
- if (IS_ERR(fp)) {
- err = PTR_ERR(fp);
+ dentry = get_xa_file_dentry(inode, name, flags);
+ if (IS_ERR(dentry)) {
+ err = PTR_ERR(dentry);
goto out;
}
- xinode = fp->f_path.dentry->d_inode;
+ xinode = dentry->d_inode;
REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
/* we need to copy it off.. */
if (xinode->i_nlink > 1) {
- fput(fp);
+ dput(dentry);
err = reiserfs_xattr_del(inode, name);
if (err < 0)
goto out;
@@ -479,7 +454,7 @@ reiserfs_xattr_set(struct inode *inode,
newattrs.ia_size = buffer_size;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
mutex_lock(&xinode->i_mutex);
- err = notify_change(fp->f_path.dentry, &newattrs);
+ err = notify_change(dentry, &newattrs);
if (err)
goto out_filp;
@@ -512,15 +487,15 @@ reiserfs_xattr_set(struct inode *inode,
rxh->h_hash = cpu_to_le32(xahash);
}
- err = mapping->a_ops->prepare_write(fp, page, page_offset,
+ err = mapping->a_ops->prepare_write(NULL, page, page_offset,
page_offset + chunk + skip);
if (!err) {
if (buffer)
memcpy(data + skip, buffer + buffer_pos, chunk);
- err =
- mapping->a_ops->commit_write(fp, page, page_offset,
- page_offset + chunk +
- skip);
+ err = mapping->a_ops->commit_write(NULL, page,
+ page_offset,
+ page_offset + chunk +
+ skip);
}
unlock_page(page);
reiserfs_put_page(page);
@@ -542,7 +517,7 @@ reiserfs_xattr_set(struct inode *inode,
out_filp:
mutex_unlock(&xinode->i_mutex);
- fput(fp);
+ dput(dentry);
out:
return err;
@@ -556,7 +531,7 @@ reiserfs_xattr_get(const struct inode *i
size_t buffer_size)
{
ssize_t err = 0;
- struct file *fp;
+ struct dentry *dentry;
size_t isize;
size_t file_pos = 0;
size_t buffer_pos = 0;
@@ -572,13 +547,13 @@ reiserfs_xattr_get(const struct inode *i
if (get_inode_sd_version(inode) == STAT_DATA_V1)
return -EOPNOTSUPP;
- fp = open_xa_file(inode, name, FL_READONLY);
- if (IS_ERR(fp)) {
- err = PTR_ERR(fp);
+ dentry = get_xa_file_dentry(inode, name, FL_READONLY);
+ if (IS_ERR(dentry)) {
+ err = PTR_ERR(dentry);
goto out;
}
- xinode = fp->f_path.dentry->d_inode;
+ xinode = dentry->d_inode;
isize = xinode->i_size;
REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
@@ -646,7 +621,7 @@ reiserfs_xattr_get(const struct inode *i
}
out_dput:
- fput(fp);
+ dput(dentry);
out:
return err;
@@ -736,7 +711,6 @@ reiserfs_delete_xattrs_filler(void *buf,
/* This is called w/ inode->i_mutex downed */
int reiserfs_delete_xattrs(struct inode *inode)
{
- struct file *fp;
struct dentry *dir, *root;
int err = 0;
@@ -757,15 +731,8 @@ int reiserfs_delete_xattrs(struct inode
return 0;
}
- fp = dentry_open(dir, NULL, O_RDWR);
- if (IS_ERR(fp)) {
- err = PTR_ERR(fp);
- /* dentry_open dputs the dentry if it fails */
- goto out;
- }
-
lock_kernel();
- err = xattr_readdir(fp, reiserfs_delete_xattrs_filler, dir);
+ err = xattr_readdir(dir->d_inode, reiserfs_delete_xattrs_filler, dir);
if (err) {
unlock_kernel();
goto out_dir;
@@ -785,7 +752,7 @@ int reiserfs_delete_xattrs(struct inode
unlock_kernel();
out_dir:
- fput(fp);
+ dput(dir);
out:
if (!err)
@@ -827,7 +794,6 @@ reiserfs_chown_xattrs_filler(void *buf,
int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
{
- struct file *fp;
struct dentry *dir;
int err = 0;
struct reiserfs_chown_buf buf;
@@ -851,13 +817,6 @@ int reiserfs_chown_xattrs(struct inode *
goto out;
}
- fp = dentry_open(dir, NULL, O_RDWR);
- if (IS_ERR(fp)) {
- err = PTR_ERR(fp);
- /* dentry_open dputs the dentry if it fails */
- goto out;
- }
-
lock_kernel();
attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME);
@@ -865,7 +824,7 @@ int reiserfs_chown_xattrs(struct inode *
buf.attrs = attrs;
buf.inode = inode;
- err = xattr_readdir(fp, reiserfs_chown_xattrs_filler, &buf);
+ err = xattr_readdir(dir->d_inode, reiserfs_chown_xattrs_filler, &buf);
if (err) {
unlock_kernel();
goto out_dir;
@@ -875,7 +834,7 @@ int reiserfs_chown_xattrs(struct inode *
unlock_kernel();
out_dir:
- fput(fp);
+ dput(dir);
out:
attrs->ia_valid = ia_valid;
@@ -1023,7 +982,6 @@ reiserfs_listxattr_filler(void *buf, con
*/
ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
{
- struct file *fp;
struct dentry *dir;
int err = 0;
struct reiserfs_listxattr_buf buf;
@@ -1046,13 +1004,6 @@ ssize_t reiserfs_listxattr(struct dentry
goto out;
}
- fp = dentry_open(dir, NULL, O_RDWR);
- if (IS_ERR(fp)) {
- err = PTR_ERR(fp);
- /* dentry_open dputs the dentry if it fails */
- goto out;
- }
-
buf.r_buf = buffer;
buf.r_size = buffer ? size : 0;
buf.r_pos = 0;
@@ -1060,7 +1011,7 @@ ssize_t reiserfs_listxattr(struct dentry
REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir;
- err = xattr_readdir(fp, reiserfs_listxattr_filler, &buf);
+ err = xattr_readdir(dir->d_inode, reiserfs_listxattr_filler, &buf);
if (err)
goto out_dir;
@@ -1070,7 +1021,7 @@ ssize_t reiserfs_listxattr(struct dentry
err = buf.r_pos;
out_dir:
- fput(fp);
+ dput(dir);
out:
reiserfs_read_unlock_xattr_i(dentry->d_inode);
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs
2007-10-15 8:40 ` Christoph Hellwig
2007-10-15 18:31 ` Jeff Mahoney
@ 2007-10-15 19:51 ` Laurent Riffard
[not found] ` <4713B1E7.2010504@suse.com>
2 siblings, 0 replies; 9+ messages in thread
From: Laurent Riffard @ 2007-10-15 19:51 UTC (permalink / raw)
To: Christoph Hellwig, Laurent Riffard, Andrew Morton, Dave Hansen,
linux-kernel
Le 15.10.2007 10:40, Christoph Hellwig a écrit :
> On Mon, Oct 15, 2007 at 12:34:58AM +0200, Laurent Riffard wrote:
>> reiserfs_delete_xattrs
>> reiserfs_delete_inode
>> generic_delete_inode
>> generic_drop_inode
>> iput
>> do_unlinkat
>> sys_unlink
>> sys_enter_past_esp
>>
>> I reported a similar BUG in 2.6.22-rc8-mm2 (see
>> http://lkml.org/lkml/2007/9/27/235). Dave Hansen sent a patch for it, I
>> tested it and it was OK for 2.6.22-rc8-mm2.
>>
>> I tried this patch on 2.6.23-mm1, and it fixed the BUGs here too.
>
> The delete path is a similar case as the one Dave fixed, also cause by
> a NULL vfsmount passed to dentry_open, but through a different code-path.
>
> Untested fix for this problem below:
Does work fine, thanks.
Tested-by: Laurent Riffard <laurent.riffard@free.fr>
> Index: linux-2.6.23-rc8/fs/reiserfs/xattr.c
> ===================================================================
> --- linux-2.6.23-rc8.orig/fs/reiserfs/xattr.c 2007-09-30 14:13:46.000000000 +0200
> +++ linux-2.6.23-rc8/fs/reiserfs/xattr.c 2007-09-30 14:18:30.000000000 +0200
> @@ -207,9 +207,8 @@ static struct dentry *get_xa_file_dentry
> * we're called with i_mutex held, so there are no worries about the directory
> * changing underneath us.
> */
> -static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
> +static int __xattr_readdir(struct inode *inode, void *dirent, filldir_t filldir)
> {
> - struct inode *inode = filp->f_path.dentry->d_inode;
> struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
> INITIALIZE_PATH(path_to_entry);
> struct buffer_head *bh;
> @@ -352,24 +351,19 @@ static int __xattr_readdir(struct file *
> * this is stolen from vfs_readdir
> *
> */
> -static
> -int xattr_readdir(struct file *file, filldir_t filler, void *buf)
> +static int xattr_readdir(struct inode *inode, filldir_t filler, void *buf)
> {
> - struct inode *inode = file->f_path.dentry->d_inode;
> int res = -ENOTDIR;
> - if (!file->f_op || !file->f_op->readdir)
> - goto out;
> +
> mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR);
> -// down(&inode->i_zombie);
> res = -ENOENT;
> if (!IS_DEADDIR(inode)) {
> lock_kernel();
> - res = __xattr_readdir(file, buf, filler);
> + res = __xattr_readdir(inode, buf, filler);
> unlock_kernel();
> }
> -// up(&inode->i_zombie);
> mutex_unlock(&inode->i_mutex);
> - out:
> +
> return res;
> }
>
> @@ -721,7 +715,6 @@ reiserfs_delete_xattrs_filler(void *buf,
> /* This is called w/ inode->i_mutex downed */
> int reiserfs_delete_xattrs(struct inode *inode)
> {
> - struct file *fp;
> struct dentry *dir, *root;
> int err = 0;
>
> @@ -742,15 +735,8 @@ int reiserfs_delete_xattrs(struct inode
> return 0;
> }
>
> - fp = dentry_open(dir, NULL, O_RDWR);
> - if (IS_ERR(fp)) {
> - err = PTR_ERR(fp);
> - /* dentry_open dputs the dentry if it fails */
> - goto out;
> - }
> -
> lock_kernel();
> - err = xattr_readdir(fp, reiserfs_delete_xattrs_filler, dir);
> + err = xattr_readdir(dir->d_inode, reiserfs_delete_xattrs_filler, dir);
> if (err) {
> unlock_kernel();
> goto out_dir;
> @@ -770,7 +756,7 @@ int reiserfs_delete_xattrs(struct inode
> unlock_kernel();
>
> out_dir:
> - fput(fp);
> + dput(dir);
>
> out:
> if (!err)
> @@ -812,7 +798,6 @@ reiserfs_chown_xattrs_filler(void *buf,
>
> int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
> {
> - struct file *fp;
> struct dentry *dir;
> int err = 0;
> struct reiserfs_chown_buf buf;
> @@ -836,13 +821,6 @@ int reiserfs_chown_xattrs(struct inode *
> goto out;
> }
>
> - fp = dentry_open(dir, NULL, O_RDWR);
> - if (IS_ERR(fp)) {
> - err = PTR_ERR(fp);
> - /* dentry_open dputs the dentry if it fails */
> - goto out;
> - }
> -
> lock_kernel();
>
> attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME);
> @@ -850,7 +828,7 @@ int reiserfs_chown_xattrs(struct inode *
> buf.attrs = attrs;
> buf.inode = inode;
>
> - err = xattr_readdir(fp, reiserfs_chown_xattrs_filler, &buf);
> + err = xattr_readdir(dir->d_inode, reiserfs_chown_xattrs_filler, &buf);
> if (err) {
> unlock_kernel();
> goto out_dir;
> @@ -860,7 +838,7 @@ int reiserfs_chown_xattrs(struct inode *
> unlock_kernel();
>
> out_dir:
> - fput(fp);
> + dput(dir);
>
> out:
> attrs->ia_valid = ia_valid;
> @@ -1008,7 +986,6 @@ reiserfs_listxattr_filler(void *buf, con
> */
> ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
> {
> - struct file *fp;
> struct dentry *dir;
> int err = 0;
> struct reiserfs_listxattr_buf buf;
> @@ -1031,13 +1008,6 @@ ssize_t reiserfs_listxattr(struct dentry
> goto out;
> }
>
> - fp = dentry_open(dir, NULL, O_RDWR);
> - if (IS_ERR(fp)) {
> - err = PTR_ERR(fp);
> - /* dentry_open dputs the dentry if it fails */
> - goto out;
> - }
> -
> buf.r_buf = buffer;
> buf.r_size = buffer ? size : 0;
> buf.r_pos = 0;
> @@ -1045,7 +1015,7 @@ ssize_t reiserfs_listxattr(struct dentry
>
> REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir;
>
> - err = xattr_readdir(fp, reiserfs_listxattr_filler, &buf);
> + err = xattr_readdir(dir->d_inode, reiserfs_listxattr_filler, &buf);
> if (err)
> goto out_dir;
>
> @@ -1055,7 +1025,7 @@ ssize_t reiserfs_listxattr(struct dentry
> err = buf.r_pos;
>
> out_dir:
> - fput(fp);
> + dput(dir);
>
> out:
> reiserfs_read_unlock_xattr_i(dentry->d_inode);
>
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs
[not found] ` <4713B1E7.2010504@suse.com>
@ 2007-10-15 20:06 ` Laurent Riffard
2007-10-15 20:23 ` Jeff Mahoney
2007-10-17 8:59 ` Christoph Hellwig
2007-10-17 8:58 ` Christoph Hellwig
1 sibling, 2 replies; 9+ messages in thread
From: Laurent Riffard @ 2007-10-15 20:06 UTC (permalink / raw)
To: Jeff Mahoney
Cc: Christoph Hellwig, Andrew Morton, Dave Hansen, linux-kernel,
linux-fsdevel, reiserfs-devel
Le 15.10.2007 20:31, Jeff Mahoney a écrit :
> Christoph Hellwig wrote:
>> On Mon, Oct 15, 2007 at 12:34:58AM +0200, Laurent Riffard wrote:
>>> reiserfs_delete_xattrs
>>> reiserfs_delete_inode
>>> generic_delete_inode
>>> generic_drop_inode
>>> iput
>>> do_unlinkat
>>> sys_unlink
>>> sys_enter_past_esp
>>>
>>> I reported a similar BUG in 2.6.22-rc8-mm2 (see
>>> http://lkml.org/lkml/2007/9/27/235). Dave Hansen sent a patch for it, I
>>> tested it and it was OK for 2.6.22-rc8-mm2.
>>>
>>> I tried this patch on 2.6.23-mm1, and it fixed the BUGs here too.
>> The delete path is a similar case as the one Dave fixed, also cause by
>> a NULL vfsmount passed to dentry_open, but through a different code-path.
>>
>> Untested fix for this problem below:
>
> Here's a patch I worked up the other night that kills off struct file
> completely from the xattr code. I've tested it locally.
Sorry Jeff, your patch does not apply on 2.6.23-mm1. The 'struct file'
removal from reiserfs_xattr_ function is already in -mm
(make-reiserfs-stop-using-struct-file-for-internal.patch).
The Dave's patch I was refering to is this one:
==== BEGIN =====
The bug is caused by reiserfs creating a special 'struct file' with a
NULL vfsmount.
/* Opens a file pointer to the attribute associated with inode */
static struct file *open_xa_file(const struct inode *inode, const char
*name,
int flags)
{
...
fp = dentry_open(xafile, NULL, O_RDWR);
/* dentry_open dputs the dentry if it fails */
As Christoph just said, this is somewhat of a bandaid. But, it
shouldn't hurt anything.
---
lxc-dave/fs/file_table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN fs/open.c~fix-reiserfs-oops fs/open.c
diff -puN fs/file_table.c~fix-reiserfs-oops fs/file_table.c
--- lxc/fs/file_table.c~fix-reiserfs-oops 2007-09-27 13:32:20.000000000 -0700
+++ lxc-dave/fs/file_table.c 2007-09-27 13:33:11.000000000 -0700
@@ -236,7 +236,7 @@ void fastcall __fput(struct file *file)
fops_put(file->f_op);
if (file->f_mode & FMODE_WRITE) {
put_write_access(inode);
- if (!special_file(inode->i_mode))
+ if (!special_file(inode->i_mode) && mnt)
mnt_drop_write(mnt);
}
put_pid(file->f_owner.pid);
diff -puN include/linux/mount.h~fix-reiserfs-oops include/linux/mount.h
==== END ====
Dave sent it privately to me... I guess this "bandaid" is no longer
needed now, is it?
~~
laurent
-
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs
2007-10-15 20:06 ` Laurent Riffard
@ 2007-10-15 20:23 ` Jeff Mahoney
2007-10-17 8:59 ` Christoph Hellwig
1 sibling, 0 replies; 9+ messages in thread
From: Jeff Mahoney @ 2007-10-15 20:23 UTC (permalink / raw)
To: Laurent Riffard
Cc: Christoph Hellwig, Andrew Morton, Dave Hansen, linux-kernel,
linux-fsdevel, reiserfs-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Laurent Riffard wrote:
> Le 15.10.2007 20:31, Jeff Mahoney a écrit :
>> Christoph Hellwig wrote:
>>> On Mon, Oct 15, 2007 at 12:34:58AM +0200, Laurent Riffard wrote:
>>>> reiserfs_delete_xattrs
>>>> reiserfs_delete_inode
>>>> generic_delete_inode
>>>> generic_drop_inode
>>>> iput
>>>> do_unlinkat
>>>> sys_unlink
>>>> sys_enter_past_esp
>>>>
>>>> I reported a similar BUG in 2.6.22-rc8-mm2 (see
>>>> http://lkml.org/lkml/2007/9/27/235). Dave Hansen sent a patch for it, I
>>>> tested it and it was OK for 2.6.22-rc8-mm2.
>>>>
>>>> I tried this patch on 2.6.23-mm1, and it fixed the BUGs here too.
>>> The delete path is a similar case as the one Dave fixed, also cause by
>>> a NULL vfsmount passed to dentry_open, but through a different code-path.
>>>
>>> Untested fix for this problem below:
>> Here's a patch I worked up the other night that kills off struct file
>> completely from the xattr code. I've tested it locally.
>
> Sorry Jeff, your patch does not apply on 2.6.23-mm1. The 'struct file'
> removal from reiserfs_xattr_ function is already in -mm
> (make-reiserfs-stop-using-struct-file-for-internal.patch).
>
> The Dave's patch I was refering to is this one:
I'd guess not. This patch was actually against mainline. I should've
specified. I can work up one against -mm later today if it's needed.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFHE8wyLPWxlyuTD7IRAiJrAJ4nC6gwH1cFjWx6BI04O5fDIRftmACcD2wb
whyXThHlIBK2phnZ6Pf8Pb8=
=Kx6k
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs
[not found] ` <4713B1E7.2010504@suse.com>
2007-10-15 20:06 ` Laurent Riffard
@ 2007-10-17 8:58 ` Christoph Hellwig
2007-10-17 14:55 ` Jeff Mahoney
1 sibling, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2007-10-17 8:58 UTC (permalink / raw)
To: Jeff Mahoney
Cc: Christoph Hellwig, Laurent Riffard, Andrew Morton, Dave Hansen,
linux-kernel, linux-fsdevel, reiserfs-devel
On Mon, Oct 15, 2007 at 02:31:03PM -0400, Jeff Mahoney wrote:
> Here's a patch I worked up the other night that kills off struct file
> completely from the xattr code. I've tested it locally.
Looks like a merge of Dave's and my patch :)
ACK from me, I don't care whether it's one or two patches.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs
2007-10-15 20:06 ` Laurent Riffard
2007-10-15 20:23 ` Jeff Mahoney
@ 2007-10-17 8:59 ` Christoph Hellwig
1 sibling, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2007-10-17 8:59 UTC (permalink / raw)
To: Laurent Riffard
Cc: Jeff Mahoney, Christoph Hellwig, Andrew Morton, Dave Hansen,
linux-kernel, linux-fsdevel, reiserfs-devel
On Mon, Oct 15, 2007 at 10:06:04PM +0200, Laurent Riffard wrote:
> > Here's a patch I worked up the other night that kills off struct file
> > completely from the xattr code. I've tested it locally.
>
> Sorry Jeff, your patch does not apply on 2.6.23-mm1. The 'struct file'
> removal from reiserfs_xattr_ function is already in -mm
> (make-reiserfs-stop-using-struct-file-for-internal.patch).
We'll need to drop Dave's patch first. Andrew, can you drop it and
put this one in instead?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs
2007-10-17 8:58 ` Christoph Hellwig
@ 2007-10-17 14:55 ` Jeff Mahoney
0 siblings, 0 replies; 9+ messages in thread
From: Jeff Mahoney @ 2007-10-17 14:55 UTC (permalink / raw)
To: Christoph Hellwig, Jeff Mahoney, Laurent Riffard, Andrew Morton,
Dave Hansen
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Christoph Hellwig wrote:
> On Mon, Oct 15, 2007 at 02:31:03PM -0400, Jeff Mahoney wrote:
>> Here's a patch I worked up the other night that kills off struct file
>> completely from the xattr code. I've tested it locally.
>
> Looks like a merge of Dave's and my patch :)
>
> ACK from me, I don't care whether it's one or two patches.
Yeah, it probably is. I did it from scratch since it was my mess, and
the patches I saw were against -mm.
*shrug* Likewise, I don't care if it's one or two.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFHFiJHLPWxlyuTD7IRAojqAJwKS+eL1yCtUVHzBSFUxjjkW6KgPwCcDRUE
Q1V7tCPcT9h0a8ahVmYn+ms=
=5kMt
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-10-17 14:52 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20071011213126.cf92efb7.akpm@linux-foundation.org>
2007-10-14 22:34 ` 2.6.23-mm1: BUG in reiserfs_delete_xattrs Laurent Riffard
2007-10-15 8:40 ` Christoph Hellwig
2007-10-15 18:31 ` Jeff Mahoney
2007-10-15 19:51 ` Laurent Riffard
[not found] ` <4713B1E7.2010504@suse.com>
2007-10-15 20:06 ` Laurent Riffard
2007-10-15 20:23 ` Jeff Mahoney
2007-10-17 8:59 ` Christoph Hellwig
2007-10-17 8:58 ` Christoph Hellwig
2007-10-17 14:55 ` Jeff Mahoney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox