Bug#714974: [PATCH] jfs: fix readdir cookie incompatibility with NFSv4
On Thu, Aug 29, 2013 at 03:48:03PM -0700, Jonathan McDowell wrote: On Sat, Aug 17, 2013 at 10:01:31PM +0200, Ben Hutchings wrote: On Thu, 2013-08-15 at 14:26 -0700, Christian Kujau wrote: On Thu, 15 Aug 2013 at 15:48, Dave Kleikamp wrote: This patch replaces the one I posted yesterday. I like this better since it doesn't require fixing existing on-disk cookies or skipping a position in the in-inode index table. Thanks. Applied to 3.11-rc5 and tested, no more readdir loop messages and with unique inode numbers, great! Tested-by: Christian Kujau li...@nerdbynature.de Karl and Jonathan, could you test the attached backport to 3.2? I finally managed to be able to schedule some downtime yesterday for one of the machines I've been seeing this issue with. So far since the reboot to this kernel (3.2.46-1 + the patch) I haven't seen a recurrence of the problem; will update if I see anything. I see the patch hit 3.11, but just to confirm the 3.2 backport on top of the Debian 3.2.46-1 kernel has seen no recurrence or issues in the past week (with a set of JFS filesystems that are fairly extensively used over NFS). J. -- Web [ Aunt Em: Hate Kansas. Hate you. Taking dog. Bye. Dorothy. ] site: http:// [ ] Made by www.earth.li/~noodles/ [ ] HuggieTag 0.0.24 signature.asc Description: Digital signature
Bug#714974: [PATCH] jfs: fix readdir cookie incompatibility with NFSv4
On Sat, Aug 17, 2013 at 10:01:31PM +0200, Ben Hutchings wrote: On Thu, 2013-08-15 at 14:26 -0700, Christian Kujau wrote: On Thu, 15 Aug 2013 at 15:48, Dave Kleikamp wrote: This patch replaces the one I posted yesterday. I like this better since it doesn't require fixing existing on-disk cookies or skipping a position in the in-inode index table. Thanks. Applied to 3.11-rc5 and tested, no more readdir loop messages and with unique inode numbers, great! Tested-by: Christian Kujau li...@nerdbynature.de Karl and Jonathan, could you test the attached backport to 3.2? I finally managed to be able to schedule some downtime yesterday for one of the machines I've been seeing this issue with. So far since the reboot to this kernel (3.2.46-1 + the patch) I haven't seen a recurrence of the problem; will update if I see anything. J. -- Just 'cause I remembered one thing doesn't make me smart! signature.asc Description: Digital signature
Bug#714974: [PATCH] jfs: fix readdir cookie incompatibility with NFSv4
On Thu, 2013-08-15 at 14:26 -0700, Christian Kujau wrote: On Thu, 15 Aug 2013 at 15:48, Dave Kleikamp wrote: This patch replaces the one I posted yesterday. I like this better since it doesn't require fixing existing on-disk cookies or skipping a position in the in-inode index table. Thanks. Applied to 3.11-rc5 and tested, no more readdir loop messages and with unique inode numbers, great! Tested-by: Christian Kujau li...@nerdbynature.de Karl and Jonathan, could you test the attached backport to 3.2? (Instructions for rebuilding the Debian kernel package are at: http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s-common-official) Ben. -- Ben Hutchings Teamwork is essential - it allows you to blame someone else. Date: Thu, 15 Aug 2013 15:48:39 -0500 From: Dave Kleikamp dave.kleik...@oracle.com Subject: jfs: fix readdir cookie incompatibility with NFSv4 This patch replaces the one I posted yesterday. I like this better since it doesn't require fixing existing on-disk cookies or skipping a position in the in-inode index table. NFSv4 reserves readdir cookie values 0-2 for special entries (. and ..), but jfs allows a value of 2 for a non-special entry. This incompatibility can result in the nfs client reporting a readdir loop. This patch doesn't change the value stored internally, but adds one to the value exposed to the iterate method. Signed-off-by: Dave Kleikamp dave.kleik...@oracle.com [bwh: Backported to 3.2: - Adjust context - s/ctx-pos/filp-f_pos/] Signed-off-by: Ben Hutchings b...@decadent.org.uk --- fs/jfs/jfs_dtree.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 8743ba9..0ec767e 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c @@ -3047,6 +3047,14 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) dir_index = (u32) filp-f_pos; + /* + * NFSv4 reserves cookies 1 and 2 for . and .. so we add + * the value we return to the vfs is one greater than the + * one we use internally. + */ + if (dir_index) + dir_index--; + if (dir_index 1) { struct dir_table_slot dirtab_slot; @@ -3086,7 +3094,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) if (p-header.flag BT_INTERNAL) { jfs_err(jfs_readdir: bad index table); DT_PUTPAGE(mp); -filp-f_pos = -1; +filp-f_pos = DIREND; return 0; } } else { @@ -3094,15 +3102,15 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) /* * self . */ -filp-f_pos = 0; +filp-f_pos = 1; if (filldir(dirent, ., 1, 0, ip-i_ino, DT_DIR)) return 0; } /* * parent .. */ - filp-f_pos = 1; + filp-f_pos = 2; if (filldir(dirent, .., 2, 1, PARENT(ip), DT_DIR)) return 0; @@ -3123,24 +3131,25 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) /* * Legacy filesystem - OS/2 Linux JFS 0.3.6 * - * pn = index = 0: First entry . - * pn = 0; index = 1: Second entry .. + * pn = 0; index = 1: First entry . + * pn = 0; index = 2: Second entry .. * pn 0: Real entries, pn=1 - leftmost page * pn = index = -1: No more entries */ dtpos = filp-f_pos; - if (dtpos == 0) { + if (dtpos 2) { /* build . entry */ + filp-f_pos = 1; if (filldir(dirent, ., 1, filp-f_pos, ip-i_ino, DT_DIR)) return 0; - dtoffset-index = 1; + dtoffset-index = 2; filp-f_pos = dtpos; } if (dtoffset-pn == 0) { - if (dtoffset-index == 1) { + if (dtoffset-index == 2) { /* build .. entry */ if (filldir(dirent, .., 2, filp-f_pos, @@ -3233,6 +3242,12 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) } jfs_dirent-position = unique_pos++; } +/* + * We add 1 to the index because we may + * use a value of 2 internally, and NFSv4 + * doesn't like that. + */ +jfs_dirent-position++; } else { jfs_dirent-position = dtpos; len = min(d_namleft, DTLHDRDATALEN_LEGACY); signature.asc Description: This is a digitally signed message part
Bug#714974: [PATCH] jfs: fix readdir cookie incompatibility with NFSv4
This patch replaces the one I posted yesterday. I like this better since it doesn't require fixing existing on-disk cookies or skipping a position in the in-inode index table. NFSv4 reserves readdir cookie values 0-2 for special entries (. and ..), but jfs allows a value of 2 for a non-special entry. This incompatibility can result in the nfs client reporting a readdir loop. This patch doesn't change the value stored internally, but adds one to the value exposed to the iterate method. Signed-off-by: Dave Kleikamp dave.kleik...@oracle.com --- fs/jfs/jfs_dtree.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 8743ba9..0ec767e 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c @@ -3047,6 +3047,14 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) dir_index = (u32) ctx-pos; + /* +* NFSv4 reserves cookies 1 and 2 for . and .. so we add +* the value we return to the vfs is one greater than the +* one we use internally. +*/ + if (dir_index) + dir_index--; + if (dir_index 1) { struct dir_table_slot dirtab_slot; @@ -3086,7 +3094,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) if (p-header.flag BT_INTERNAL) { jfs_err(jfs_readdir: bad index table); DT_PUTPAGE(mp); - ctx-pos = -1; + ctx-pos = DIREND; return 0; } } else { @@ -3094,14 +3102,14 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) /* * self . */ - ctx-pos = 0; + ctx-pos = 1; if (!dir_emit(ctx, ., 1, ip-i_ino, DT_DIR)) return 0; } /* * parent .. */ - ctx-pos = 1; + ctx-pos = 2; if (!dir_emit(ctx, .., 2, PARENT(ip), DT_DIR)) return 0; @@ -3122,22 +3130,23 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) /* * Legacy filesystem - OS/2 Linux JFS 0.3.6 * -* pn = index = 0: First entry . -* pn = 0; index = 1: Second entry .. +* pn = 0; index = 1: First entry . +* pn = 0; index = 2: Second entry .. * pn 0: Real entries, pn=1 - leftmost page * pn = index = -1: No more entries */ dtpos = ctx-pos; - if (dtpos == 0) { + if (dtpos 2) { /* build . entry */ + ctx-pos = 1; if (!dir_emit(ctx, ., 1, ip-i_ino, DT_DIR)) return 0; - dtoffset-index = 1; + dtoffset-index = 2; ctx-pos = dtpos; } if (dtoffset-pn == 0) { - if (dtoffset-index == 1) { + if (dtoffset-index == 2) { /* build .. entry */ if (!dir_emit(ctx, .., 2, PARENT(ip), DT_DIR)) return 0; @@ -3228,6 +3237,12 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) } jfs_dirent-position = unique_pos++; } + /* +* We add 1 to the index because we may +* use a value of 2 internally, and NFSv4 +* doesn't like that. +*/ + jfs_dirent-position++; } else { jfs_dirent-position = dtpos; len = min(d_namleft, DTLHDRDATALEN_LEGACY); -- 1.8.3.4 -- To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/520d3ea7.1010...@oracle.com
Bug#714974: [PATCH] jfs: fix readdir cookie incompatibility with NFSv4
On Thu, 15 Aug 2013 at 15:48, Dave Kleikamp wrote: This patch replaces the one I posted yesterday. I like this better since it doesn't require fixing existing on-disk cookies or skipping a position in the in-inode index table. Thanks. Applied to 3.11-rc5 and tested, no more readdir loop messages and with unique inode numbers, great! Tested-by: Christian Kujau li...@nerdbynature.de Thanks for the fix! Christian. -- BOFH excuse #442: Trojan horse ran out of hay -- To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/alpine.deb.2.10.1308151420140.7...@trent.utfs.org
Bug#714974: [PATCH] jfs: fix readdir cookie incompatibility with NFSv4
On 08/15/2013 04:26 PM, Christian Kujau wrote: On Thu, 15 Aug 2013 at 15:48, Dave Kleikamp wrote: This patch replaces the one I posted yesterday. I like this better since it doesn't require fixing existing on-disk cookies or skipping a position in the in-inode index table. Thanks. Applied to 3.11-rc5 and tested, no more readdir loop messages and with unique inode numbers, great! Tested-by: Christian Kujau li...@nerdbynature.de Thanks for the fix! Christian. Thanks for reporting, investigating and testing! Dave -- To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/520d519f.6080...@oracle.com