2006-02-06 17:21:33

by Luca

[permalink] [raw]
Subject: [BUG] Linux 2.6.16-rcX breaks mutt

Hi,
I found out that mutt when running with a 2.6.16-rcX kernel is unable to
discover new mails in mboxes other than the main one.
On my system mail is downloaded using fetchmail, which hands the mails
to procmail; procmail then saves the mails in the correct mbox (for
example each mailing list has its own mbox). Using mutt, the 'c' key is
used to changed mbox and it defaults to the first mbox that has new
mail. With kernel 2.6.16 'c' has no effects (mutt seems to think that
there's no new mail).

I think that the problem is related to the changes in:
fs/xfs/linux-2.6/xfs_iops.c

I've done a simple test with working and non working system:

* With kernel 2.6.16-rc2

Empty file:

kronos:~/Mail/Lists$ stat ML-testml-February-2006
File: `ML-testml-February-2006'
Size: 994 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 26045738 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ kronos) Gid: ( 100/ users)
Access: 2006-02-05 18:42:52.185598250 +0100
Modify: 2006-02-05 18:42:53.189661000 +0100
Change: 2006-02-05 18:42:53.189661000 +0100

Mutt opened:

kronos:~/Mail/Lists$ stat ML-testml-February-2006
File: `ML-testml-February-2006'
Size: 994 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 26045738 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ kronos) Gid: ( 100/ users)
Access: 2006-02-05 18:43:05.338420250 +0100
Modify: 2006-02-05 18:42:53.000000000 +0100
Change: 2006-02-05 18:43:05.338420250 +0100

New mail:

kronos:~/Mail/Lists$ stat ML-testml-February-2006
File: `ML-testml-February-2006'
Size: 1940 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 26045738 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ kronos) Gid: ( 100/ users)
Access: 2006-02-05 18:43:05.338420250 +0100
Modify: 2006-02-05 18:43:31.960084000 +0100
Change: 2006-02-05 18:43:31.960084000 +0100

Mutt opened:

kronos:~/Mail/Lists$ stat ML-testml-February-2006
File: `ML-testml-February-2006'
Size: 1940 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 26045738 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ kronos) Gid: ( 100/ users)
Access: 2006-02-05 18:43:59.073778500 +0100
Modify: 2006-02-05 18:43:31.000000000 +0100
Change: 2006-02-05 18:43:59.073778500 +0100

* With kernel 2.6.15

Before:

kronos:~/Mail/Lists$ stat ML-testml-February-2006
File: `ML-testml-February-2006'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 306h/774d Inode: 26045738 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ kronos) Gid: ( 100/ users)
Access: 2006-02-05 18:46:13.186160000 +0100
Modify: 2006-02-05 18:46:06.000000000 +0100
Change: 2006-02-05 18:46:13.198160750 +0100

New mail:

kronos:~/Mail/Lists$ stat ML-testml-February-2006
File: `ML-testml-February-2006'
Size: 1187 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 26045738 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ kronos) Gid: ( 100/ users)
Access: 2006-02-05 18:46:13.186160000 +0100
Modify: 2006-02-06 17:38:24.547425000 +0100
Change: 2006-02-06 17:38:24.547425000 +0100

Mutt opened:

kronos:~/Mail/Lists$ stat ML-testml-February-2006
File: `ML-testml-February-2006'
Size: 1187 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 26045738 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ kronos) Gid: ( 100/ users)
Access: 2006-02-05 18:46:13.000000000 +0100
Modify: 2006-02-06 17:38:24.000000000 +0100
Change: 2006-02-06 17:38:36.856194250 +0100

Note that with 2.6.15 the atime of the mbox is unchanged after opening
mutt, while with 2.6.16-rc2 it does change (I guess that's what confuses
mutt).

Also, looking at strace mutt reads the mbox (so atime changes) but
immediatly resets atime using utime:

stat64("/home/kronos/Mail/Lists/ML-testml-February-2006",
{st_dev=makedev(3, 6), st_ino=26045738, st_mode=S_IFREG|0600,
st_nlink=1, st_uid=1000, st_gid=100, st_blksize=4096, st_blocks=8,
st_size=2159, st_atime=2006/02/05-18:46:13,
st_mtime=2006/02/06-17:39:07, st_ctime=2006/02/06-18:01:12}) = 0

stat64("/home/kronos/Mail/Lists/ML-testml-February-2006",
{st_dev=makedev(3, 6), st_ino=26045738, st_mode=S_IFREG|0600,
st_nlink=1, st_uid=1000, st_gid=100, st_blksize=4096, st_blocks=8,
st_size=2159, st_atime=2006/02/05-18:46:13,
st_mtime=2006/02/06-17:39:07, st_ctime=2006/02/06-18:01:12}) = 0

open("/home/kronos/Mail/Lists/ML-testml-February-2006", O_RDONLY|O_LARGEFILE) = 4

fstat64(4, {st_dev=makedev(3, 6), st_ino=26045738, st_mode=S_IFREG|0600,
st_nlink=1, st_uid=1000, st_gid=100, st_blksize=4096, st_blocks=8,
st_size=2159, st_atime=2006/02/05-18:46:13,
st_mtime=2006/02/06-17:39:07, st_ctime=2006/02/06-18:01:12}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f76000
read(4, "From [email protected] Mon "..., 4096) = 2159
close(4) = 0
munmap(0xb7f76000, 4096) = 0

utime("/home/kronos/Mail/Lists/ML-testml-February-2006",
[2006/02/05-18:46:13, 2006/02/06-17:39:07]) = 0

Luca
(Please CC me)
--
Home: http://kronoz.cjb.net
"La Via prosegue senza fine."
Bilbo Baggins - Il Signore degli Anelli - J.R.R. Tolkien


2006-02-06 21:33:05

by Nathan Scott

[permalink] [raw]
Subject: Re: [BUG] Linux 2.6.16-rcX breaks mutt

On Mon, Feb 06, 2006 at 06:21:41PM +0100, Luca wrote:
> Hi,

Hi Luca,

> I found out that mutt when running with a 2.6.16-rcX kernel is unable to
> discover new mails in mboxes other than the main one.
> ...
> I think that the problem is related to the changes in:
> fs/xfs/linux-2.6/xfs_iops.c

Indeed, there have been some atime related changes recently.

> I've done a simple test with working and non working system:

Thanks for the details, I should be able to reproduce and fix it
from that - I'll get back to you soon.

cheers.

--
Nathan

2006-02-06 23:33:50

by Nathan Scott

[permalink] [raw]
Subject: Re: [BUG] Linux 2.6.16-rcX breaks mutt

Hi Luca,

On Mon, Feb 06, 2006 at 06:21:41PM +0100, Luca wrote:
> Hi,
> I found out that mutt when running with a 2.6.16-rcX kernel is unable to
> discover new mails in mboxes other than the main one.
> ...
> I've done a simple test with working and non working system:

I constructed a test case based on your description, and this patch
fixes it for me - could you try it out & let me know how it goes in
yoour case?

thanks.

--
Nathan

--- fs/xfs/linux-2.6/xfs_iops.c.orig 2006-02-07 10:49:34.143620000 +1100
+++ fs/xfs/linux-2.6/xfs_iops.c 2006-02-07 10:49:57.785097500 +1100
@@ -673,6 +673,8 @@ linvfs_setattr(
if (ia_valid & ATTR_ATIME) {
vattr.va_mask |= XFS_AT_ATIME;
vattr.va_atime = attr->ia_atime;
+ if (ia_valid & ATTR_ATIME_SET)
+ inode->i_atime = attr->ia_atime;
}
if (ia_valid & ATTR_MTIME) {
vattr.va_mask |= XFS_AT_MTIME;

2006-02-07 14:49:28

by Luca

[permalink] [raw]
Subject: Re: [BUG] Linux 2.6.16-rcX breaks mutt

Il Tue, Feb 07, 2006 at 10:30:46AM +1100, Nathan Scott ha scritto:
> Hi Luca,
>
> On Mon, Feb 06, 2006 at 06:21:41PM +0100, Luca wrote:
> > Hi,
> > I found out that mutt when running with a 2.6.16-rcX kernel is unable to
> > discover new mails in mboxes other than the main one.
> > ...
> > I've done a simple test with working and non working system:
>
> I constructed a test case based on your description, and this patch
> fixes it for me - could you try it out & let me know how it goes in
> yoour case?

Tested now, it's working.

> --- fs/xfs/linux-2.6/xfs_iops.c.orig 2006-02-07 10:49:34.143620000 +1100
> +++ fs/xfs/linux-2.6/xfs_iops.c 2006-02-07 10:49:57.785097500 +1100
> @@ -673,6 +673,8 @@ linvfs_setattr(
> if (ia_valid & ATTR_ATIME) {
> vattr.va_mask |= XFS_AT_ATIME;
> vattr.va_atime = attr->ia_atime;
> + if (ia_valid & ATTR_ATIME_SET)
> + inode->i_atime = attr->ia_atime;
> }
> if (ia_valid & ATTR_MTIME) {
> vattr.va_mask |= XFS_AT_MTIME;

thanks,
Luca
--
Home: http://kronoz.cjb.net
La somma dell'intelligenza sulla terra e` una costante.
La popolazione e` in aumento.