Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 104844 - 2.6.13 flocks_remove_flock runs into BUG()
Summary: 2.6.13 flocks_remove_flock runs into BUG()
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-04 14:45 UTC by Jakub Jozwicki
Modified: 2005-09-11 08:02 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jozwicki 2005-09-04 14:45:19 UTC
Function flocks_remove_flock changed from 2.6.12 to 2.6.13: IS_POSIX from "if
(IS_FLOCK(fl) || IS_POSIX(fl))" has been deleted. Because of that, code runs
into BUG() which is below two 'if' instructions.

Reproducible: Always
Steps to Reproduce:
1.emerge gentoo-sources-2.6.13 && emerge unionfs
2.build live cd with gentoo
3.kernel crashes with BUG() in flocks_remove_flock




Patch for kernel:

--- fs/locks.c 2005-09-02 16:38:40.770509784 +0200
+++ fs/locks-fixed.c 2005-09-02 16:37:22.000000000
+0200
@@ -1908,7 +1908,7 @@

while ((fl = *before) != NULL) {
if (fl->fl_file == filp) {
- if (IS_FLOCK(fl)) {
+ if (IS_FLOCK(fl) || IS_POSIX(fl)) {
locks_delete_lock(before);
continue;
} 

Patch for unionfs to compile on 2.6.13:

 --- unionfs-1.0.13/inode.c 2005-07-22 19:16:48.000000000
+0200
+++ unionfs-1.0.13-0/inode.c 2005-09-02 01:57:04.850697936
+0200
@@ -884,7 +884,7 @@
return err;
}

-static int unionfs_follow_link(struct dentry *dentry, struct
nameidata *nd)
+static void* unionfs_follow_link(struct dentry *dentry, struct
nameidata *nd)
{
char *buf;
int len = PAGE_SIZE, err;
@@ -922,11 +922,11 @@
KFREE(buf);
#endif
print_exit_status(err);
- return err;
+ return ERR_PTR(err);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-void unionfs_put_link(struct dentry *dentry, struct nameidata
*nd)
+void unionfs_put_link(struct dentry *dentry, struct nameidata
*nd, void *cookie)
{
char *link;
print_entry_location();
--- unionfs-1.0.13/Makefile 2005-07-22 19:16:48.000000000
+0200
+++ unionfs-1.0.13-0/Makefile 2005-09-02 02:07:13.145223112
+0200
@@ -62,7 +62,7 @@
ld -o ${obj-m} -r ${unionfs-objs}

unionctl: unionctl.c usercommon.c
- ${CC} -o $@ $^ ${UCFLAGS}
+ ${CC} -o $@ $^ ${UCFLAGS} -static

uniondbg: uniondbg.c
${CC} -o $@ $^ ${UCFLAGS}
--- unionfs-1.0.13/stale_inode.c 2005-07-22
19:16:48.000000000 +0200
+++ unionfs-1.0.13-0/stale_inode.c 2005-09-02
02:15:40.772052104 +0200
@@ -30,9 +30,10 @@
* so that a stale root inode can at least be unmounted. To do
this
* we must dput() the base and return the dentry with a dget().
*/
-static int stale_follow_link(struct dentry *dent, struct
nameidata *nd)
+static void* stale_follow_link(struct dentry *dent, struct
nameidata *nd)
{
- return vfs_follow_link(nd, ERR_PTR(-ESTALE));
+ int err = vfs_follow_link(nd, ERR_PTR(-ESTALE));
+ return ERR_PTR(err);
}

static int return_ESTALE(void)
Comment 1 Daniel Drake (RETIRED) gentoo-dev 2005-09-06 01:35:04 UTC
Where has the kernel patch come from? Was it written by you? Has it been
submitted upstream?
Comment 2 Jakub Jozwicki 2005-09-06 06:18:56 UTC
I wrote patch for kernel during work on Hackett Linux LiveCD (hackett.linux.pl).
I sent it to linux-fsdevel@vger.kernel.org, but it appears that it was eaten by
antispam or something.
Patch for unionfs is in unionfs CVS.
Comment 3 Daniel Drake (RETIRED) gentoo-dev 2005-09-06 10:13:11 UTC
Please discuss this patch with Peter Staubach <staubach@redhat.com> (CC Linux
kernel mailing list) as by the look of his recent change, he specifically did
_not_ check IS_POSIX(fl). See his patch and a long description:

http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff_plain;h=c293621bbf678a3d85e3ed721c3921c8a670610d;hp=3e5ea098446e19175fdee4c2c4ec9366b0217db4
Comment 4 Daniel Drake (RETIRED) gentoo-dev 2005-09-11 08:02:37 UTC
Please reopen this once a fix has been applied upstream