[PATCH linux-next V2] tty: Disable default console blanking interval
BugLink: http://bugs.launchpad.net/bugs/869017 Console blanking is not enabling DPMS power saving (thereby negating any power-saving benefit), and is simply turning the screen content blank. This means that any crash output is invisible which is unhelpful on a server (virtual or otherwise). Furthermore, CRT burn in concerns should no longer govern the default case. Affected users could always set consoleblank on the kernel command line. Signed-off-by: Tim Gardner <tim.gard...@canonical.com> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Cc: Jiri Slaby <jsl...@suse.com> Cc: Adam Borowski <kilob...@angband.pl> Cc: Scot Doyle <lkm...@scotdoyle.com> --- I'm not particularly knowledgable about console issues. Is a blaknking interval relevant in a post CRT world ? The argument in the bug description seems compelling. V2 - expanded commit log with relevant context. drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 5c4933b..9c99452 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -181,7 +181,7 @@ int console_blanked; static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */ static int vesa_off_interval; -static int blankinterval = 10*60; +static int blankinterval; core_param(consoleblank, blankinterval, int, 0444); static DECLARE_WORK(console_work, console_callback); -- 2.7.4
[PATCH linux-next V2] tty: Disable default console blanking interval
BugLink: http://bugs.launchpad.net/bugs/869017 Console blanking is not enabling DPMS power saving (thereby negating any power-saving benefit), and is simply turning the screen content blank. This means that any crash output is invisible which is unhelpful on a server (virtual or otherwise). Furthermore, CRT burn in concerns should no longer govern the default case. Affected users could always set consoleblank on the kernel command line. Signed-off-by: Tim Gardner Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: Adam Borowski Cc: Scot Doyle --- I'm not particularly knowledgable about console issues. Is a blaknking interval relevant in a post CRT world ? The argument in the bug description seems compelling. V2 - expanded commit log with relevant context. drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 5c4933b..9c99452 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -181,7 +181,7 @@ int console_blanked; static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */ static int vesa_off_interval; -static int blankinterval = 10*60; +static int blankinterval; core_param(consoleblank, blankinterval, int, 0444); static DECLARE_WORK(console_work, console_callback); -- 2.7.4
[PATCH linux-next] tty: Disable default console blanking interval
BugLink: http://bugs.launchpad.net/bugs/869017 Signed-off-by: Tim Gardner <tim.gard...@canonical.com> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Cc: Jiri Slaby <jsl...@suse.com> Cc: Adam Borowski <kilob...@angband.pl> Cc: Scot Doyle <lkm...@scotdoyle.com> --- I'm not particularly knowledgable about console issues. Is a blaknking interval relevant in a post CRT world ? The argument in the bug description seems compelling. drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 5c4933b..9c99452 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -181,7 +181,7 @@ int console_blanked; static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */ static int vesa_off_interval; -static int blankinterval = 10*60; +static int blankinterval; core_param(consoleblank, blankinterval, int, 0444); static DECLARE_WORK(console_work, console_callback); -- 2.7.4
[PATCH linux-next] tty: Disable default console blanking interval
BugLink: http://bugs.launchpad.net/bugs/869017 Signed-off-by: Tim Gardner Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: Adam Borowski Cc: Scot Doyle --- I'm not particularly knowledgable about console issues. Is a blaknking interval relevant in a post CRT world ? The argument in the bug description seems compelling. drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 5c4933b..9c99452 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -181,7 +181,7 @@ int console_blanked; static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */ static int vesa_off_interval; -static int blankinterval = 10*60; +static int blankinterval; core_param(consoleblank, blankinterval, int, 0444); static DECLARE_WORK(console_work, console_callback); -- 2.7.4
[PATCH v4.4-rc8 3/4] x86/microcode/intel: load_microcode: Squelch frame size warning
From: Tim Gardner arch/x86/kernel/cpu/microcode/intel.c: In function 'load_microcode.isra.2.constprop': arch/x86/kernel/cpu/microcode/intel.c:130:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 5.3.1 20160101 (Ubuntu 5.3.1-5ubuntu1) Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Signed-off-by: Tim Gardner --- arch/x86/kernel/cpu/microcode/intel.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index ebf5e66..e019c11 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -111,22 +111,30 @@ static enum ucode_state load_microcode(struct mc_saved_data *mc_saved_data, unsigned long *initrd, unsigned long initrd_start, struct ucode_cpu_info *uci) { - struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT]; + struct microcode_intel **mc_saved_tmp; unsigned int count = mc_saved_data->mc_saved_count; + enum ucode_state state; + + mc_saved_tmp = kcalloc(MAX_UCODE_COUNT, sizeof(*mc_saved_tmp), + GFP_KERNEL); + if (!mc_saved_tmp) + return UCODE_ERROR; if (!mc_saved_data->mc_saved) { copy_initrd_ptrs(mc_saved_tmp, initrd, initrd_start, count); - return load_microcode_early(mc_saved_tmp, count, uci); + state = load_microcode_early(mc_saved_tmp, count, uci); } else { #ifdef CONFIG_X86_32 microcode_phys(mc_saved_tmp, mc_saved_data); - return load_microcode_early(mc_saved_tmp, count, uci); + state = load_microcode_early(mc_saved_tmp, count, uci); #else - return load_microcode_early(mc_saved_data->mc_saved, + state = load_microcode_early(mc_saved_data->mc_saved, count, uci); #endif } + kfree(mc_saved_tmp); + return state; } /* -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4.4-rc8 4/4] x86/microcode/intel: get_matching_model_microcode: Squelch frame size warning
From: Tim Gardner arch/x86/kernel/cpu/microcode/intel.c: In function 'get_matching_model_microcode.isra.3.constprop': arch/x86/kernel/cpu/microcode/intel.c:348:1: warning: the frame size of 1080 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 5.3.1 20160101 (Ubuntu 5.3.1-5ubuntu1) Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Signed-off-by: Tim Gardner --- arch/x86/kernel/cpu/microcode/intel.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index e019c11..03099ea 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -303,11 +303,16 @@ get_matching_model_microcode(int cpu, unsigned long start, enum ucode_state state = UCODE_OK; unsigned int mc_size; struct microcode_header_intel *mc_header; - struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT]; + struct microcode_intel **mc_saved_tmp; unsigned int mc_saved_count = mc_saved_data->mc_saved_count; int i; - while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) { + mc_saved_tmp = kcalloc(MAX_UCODE_COUNT, sizeof(*mc_saved_tmp), + GFP_KERNEL); + if (!mc_saved_tmp) + return UCODE_ERROR; + + while (leftover && mc_saved_count < MAX_UCODE_COUNT) { if (leftover < sizeof(mc_header)) break; @@ -352,6 +357,7 @@ get_matching_model_microcode(int cpu, unsigned long start, mc_saved_data->mc_saved_count = mc_saved_count; out: + kfree(mc_saved_tmp); return state; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4.4-rc8 1/4] x86/microcode/intel: save_mc_for_early: Squelch frame size warning
From: Tim Gardner arch/x86/kernel/cpu/microcode/intel.c: In function 'save_mc_for_early': arch/x86/kernel/cpu/microcode/intel.c:516:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 5.3.1 20160101 (Ubuntu 5.3.1-5ubuntu1) Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Signed-off-by: Tim Gardner --- arch/x86/kernel/cpu/microcode/intel.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index ce47402..bee5e84 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -463,13 +463,18 @@ static DEFINE_MUTEX(x86_cpu_microcode_mutex); */ int save_mc_for_early(u8 *mc) { - struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT]; + struct microcode_intel **mc_saved_tmp; unsigned int mc_saved_count_init; unsigned int mc_saved_count; struct microcode_intel **mc_saved; int ret = 0; int i; + mc_saved_tmp = kcalloc(MAX_UCODE_COUNT, sizeof(*mc_saved_tmp), + GFP_KERNEL); + if (!mc_saved_tmp) + return -ENOMEM; + /* * Hold hotplug lock so mc_saved_data is not accessed by a CPU in * hotplug. @@ -512,6 +517,7 @@ int save_mc_for_early(u8 *mc) out: mutex_unlock(_cpu_microcode_mutex); + kfree(mc_saved_tmp); return ret; } EXPORT_SYMBOL_GPL(save_mc_for_early); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4.4-rc8 2/4] x86/microcode/intel: save_microcode_in_initrd_intel: Squelch frame size warning
From: Tim Gardner arch/x86/kernel/cpu/microcode/intel.c: In function 'save_microcode_in_initrd_intel': arch/x86/kernel/cpu/microcode/intel.c:705:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 5.3.1 20160101 (Ubuntu 5.3.1-5ubuntu1) Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Signed-off-by: Tim Gardner --- arch/x86/kernel/cpu/microcode/intel.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index bee5e84..ebf5e66 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -694,12 +694,16 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early) int __init save_microcode_in_initrd_intel(void) { unsigned int count = mc_saved_data.mc_saved_count; - struct microcode_intel *mc_saved[MAX_UCODE_COUNT]; + struct microcode_intel **mc_saved; int ret = 0; if (count == 0) return ret; + mc_saved = kcalloc(MAX_UCODE_COUNT, sizeof(*mc_saved), GFP_KERNEL); + if (!mc_saved) + return -ENOMEM; + copy_initrd_ptrs(mc_saved, mc_saved_in_initrd, initrd_start, count); ret = save_microcode(_saved_data, mc_saved, count); if (ret) @@ -707,6 +711,7 @@ int __init save_microcode_in_initrd_intel(void) show_saved_mc(); + kfree(mc_saved); return ret; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4.4-rc8 3/4] x86/microcode/intel: load_microcode: Squelch frame size warning
From: Tim Gardner <tim.gard...@canonical.com> arch/x86/kernel/cpu/microcode/intel.c: In function 'load_microcode.isra.2.constprop': arch/x86/kernel/cpu/microcode/intel.c:130:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 5.3.1 20160101 (Ubuntu 5.3.1-5ubuntu1) Cc: Borislav Petkov <b...@alien8.de> Cc: Thomas Gleixner <t...@linutronix.de> Cc: Ingo Molnar <mi...@redhat.com> Cc: "H. Peter Anvin" <h...@zytor.com> Signed-off-by: Tim Gardner <tim.gard...@canonical.com> --- arch/x86/kernel/cpu/microcode/intel.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index ebf5e66..e019c11 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -111,22 +111,30 @@ static enum ucode_state load_microcode(struct mc_saved_data *mc_saved_data, unsigned long *initrd, unsigned long initrd_start, struct ucode_cpu_info *uci) { - struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT]; + struct microcode_intel **mc_saved_tmp; unsigned int count = mc_saved_data->mc_saved_count; + enum ucode_state state; + + mc_saved_tmp = kcalloc(MAX_UCODE_COUNT, sizeof(*mc_saved_tmp), + GFP_KERNEL); + if (!mc_saved_tmp) + return UCODE_ERROR; if (!mc_saved_data->mc_saved) { copy_initrd_ptrs(mc_saved_tmp, initrd, initrd_start, count); - return load_microcode_early(mc_saved_tmp, count, uci); + state = load_microcode_early(mc_saved_tmp, count, uci); } else { #ifdef CONFIG_X86_32 microcode_phys(mc_saved_tmp, mc_saved_data); - return load_microcode_early(mc_saved_tmp, count, uci); + state = load_microcode_early(mc_saved_tmp, count, uci); #else - return load_microcode_early(mc_saved_data->mc_saved, + state = load_microcode_early(mc_saved_data->mc_saved, count, uci); #endif } + kfree(mc_saved_tmp); + return state; } /* -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4.4-rc8 2/4] x86/microcode/intel: save_microcode_in_initrd_intel: Squelch frame size warning
From: Tim Gardner <tim.gard...@canonical.com> arch/x86/kernel/cpu/microcode/intel.c: In function 'save_microcode_in_initrd_intel': arch/x86/kernel/cpu/microcode/intel.c:705:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 5.3.1 20160101 (Ubuntu 5.3.1-5ubuntu1) Cc: Borislav Petkov <b...@alien8.de> Cc: Thomas Gleixner <t...@linutronix.de> Cc: Ingo Molnar <mi...@redhat.com> Cc: "H. Peter Anvin" <h...@zytor.com> Signed-off-by: Tim Gardner <tim.gard...@canonical.com> --- arch/x86/kernel/cpu/microcode/intel.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index bee5e84..ebf5e66 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -694,12 +694,16 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early) int __init save_microcode_in_initrd_intel(void) { unsigned int count = mc_saved_data.mc_saved_count; - struct microcode_intel *mc_saved[MAX_UCODE_COUNT]; + struct microcode_intel **mc_saved; int ret = 0; if (count == 0) return ret; + mc_saved = kcalloc(MAX_UCODE_COUNT, sizeof(*mc_saved), GFP_KERNEL); + if (!mc_saved) + return -ENOMEM; + copy_initrd_ptrs(mc_saved, mc_saved_in_initrd, initrd_start, count); ret = save_microcode(_saved_data, mc_saved, count); if (ret) @@ -707,6 +711,7 @@ int __init save_microcode_in_initrd_intel(void) show_saved_mc(); + kfree(mc_saved); return ret; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4.4-rc8 4/4] x86/microcode/intel: get_matching_model_microcode: Squelch frame size warning
From: Tim Gardner <tim.gard...@canonical.com> arch/x86/kernel/cpu/microcode/intel.c: In function 'get_matching_model_microcode.isra.3.constprop': arch/x86/kernel/cpu/microcode/intel.c:348:1: warning: the frame size of 1080 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 5.3.1 20160101 (Ubuntu 5.3.1-5ubuntu1) Cc: Borislav Petkov <b...@alien8.de> Cc: Thomas Gleixner <t...@linutronix.de> Cc: Ingo Molnar <mi...@redhat.com> Cc: "H. Peter Anvin" <h...@zytor.com> Signed-off-by: Tim Gardner <tim.gard...@canonical.com> --- arch/x86/kernel/cpu/microcode/intel.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index e019c11..03099ea 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -303,11 +303,16 @@ get_matching_model_microcode(int cpu, unsigned long start, enum ucode_state state = UCODE_OK; unsigned int mc_size; struct microcode_header_intel *mc_header; - struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT]; + struct microcode_intel **mc_saved_tmp; unsigned int mc_saved_count = mc_saved_data->mc_saved_count; int i; - while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) { + mc_saved_tmp = kcalloc(MAX_UCODE_COUNT, sizeof(*mc_saved_tmp), + GFP_KERNEL); + if (!mc_saved_tmp) + return UCODE_ERROR; + + while (leftover && mc_saved_count < MAX_UCODE_COUNT) { if (leftover < sizeof(mc_header)) break; @@ -352,6 +357,7 @@ get_matching_model_microcode(int cpu, unsigned long start, mc_saved_data->mc_saved_count = mc_saved_count; out: + kfree(mc_saved_tmp); return state; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4.4-rc8 1/4] x86/microcode/intel: save_mc_for_early: Squelch frame size warning
From: Tim Gardner <tim.gard...@canonical.com> arch/x86/kernel/cpu/microcode/intel.c: In function 'save_mc_for_early': arch/x86/kernel/cpu/microcode/intel.c:516:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 5.3.1 20160101 (Ubuntu 5.3.1-5ubuntu1) Cc: Borislav Petkov <b...@alien8.de> Cc: Thomas Gleixner <t...@linutronix.de> Cc: Ingo Molnar <mi...@redhat.com> Cc: "H. Peter Anvin" <h...@zytor.com> Signed-off-by: Tim Gardner <tim.gard...@canonical.com> --- arch/x86/kernel/cpu/microcode/intel.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index ce47402..bee5e84 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -463,13 +463,18 @@ static DEFINE_MUTEX(x86_cpu_microcode_mutex); */ int save_mc_for_early(u8 *mc) { - struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT]; + struct microcode_intel **mc_saved_tmp; unsigned int mc_saved_count_init; unsigned int mc_saved_count; struct microcode_intel **mc_saved; int ret = 0; int i; + mc_saved_tmp = kcalloc(MAX_UCODE_COUNT, sizeof(*mc_saved_tmp), + GFP_KERNEL); + if (!mc_saved_tmp) + return -ENOMEM; + /* * Hold hotplug lock so mc_saved_data is not accessed by a CPU in * hotplug. @@ -512,6 +517,7 @@ int save_mc_for_early(u8 *mc) out: mutex_unlock(_cpu_microcode_mutex); + kfree(mc_saved_tmp); return ret; } EXPORT_SYMBOL_GPL(save_mc_for_early); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4.3-rc7] be2iscsi : Fix bogus WARN_ON length check
On 10/30/2015 02:59 PM, Johannes Thumshirn wrote: > Hi Tim, > tim.gard...@canonical.com writes: > >> From: Tim Gardner >> >> drivers/scsi/be2iscsi/be_main.c: In function 'be_sgl_create_contiguous': >> drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only >> applied to the left hand side of comparison [-Wlogical-not-parentheses] >> WARN_ON(!length > 0); >> >> gcc version 5.2.1 > > This patch (or similar) was already posted on Oct 1 by Joel Stanley. > See http://comments.gmane.org/gmane.linux.scsi/105462 > > Thanks, > Johannes > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > Mechanical application of prarens makes that expression more complicated then it needs to be. It is, after all, an unsigned integer. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4.3-rc7] be2iscsi : Fix bogus WARN_ON length check
On 10/30/2015 02:59 PM, Johannes Thumshirn wrote: > Hi Tim, > tim.gard...@canonical.com writes: > >> From: Tim Gardner <tim.gard...@canonical.com> >> >> drivers/scsi/be2iscsi/be_main.c: In function 'be_sgl_create_contiguous': >> drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only >> applied to the left hand side of comparison [-Wlogical-not-parentheses] >> WARN_ON(!length > 0); >> >> gcc version 5.2.1 > > This patch (or similar) was already posted on Oct 1 by Joel Stanley. > See http://comments.gmane.org/gmane.linux.scsi/105462 > > Thanks, > Johannes > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > Mechanical application of prarens makes that expression more complicated then it needs to be. It is, after all, an unsigned integer. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4.3-rc7] be2iscsi : Fix bogus WARN_ON length check
From: Tim Gardner drivers/scsi/be2iscsi/be_main.c: In function 'be_sgl_create_contiguous': drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] WARN_ON(!length > 0); gcc version 5.2.1 Cc: Jayamohan Kallickal Cc: Minh Tran Cc: John Soni Jose Cc: "James E.J. Bottomley" Signed-off-by: Tim Gardner --- drivers/scsi/be2iscsi/be_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 7a6dbfb..5cdcd29 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address, { WARN_ON(!virtual_address); WARN_ON(!physical_address); - WARN_ON(!length > 0); + WARN_ON(!length); WARN_ON(!sgl); sgl->va = virtual_address; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4.3-rc7] be2iscsi : Fix bogus WARN_ON length check
From: Tim Gardner <tim.gard...@canonical.com> drivers/scsi/be2iscsi/be_main.c: In function 'be_sgl_create_contiguous': drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] WARN_ON(!length > 0); gcc version 5.2.1 Cc: Jayamohan Kallickal <jayamohan.kallic...@avagotech.com> Cc: Minh Tran <minh.t...@avagotech.com> Cc: John Soni Jose <sony.joh...@avagotech.com> Cc: "James E.J. Bottomley" <jbottom...@odin.com> Signed-off-by: Tim Gardner <tim.gard...@canonical.com> --- drivers/scsi/be2iscsi/be_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 7a6dbfb..5cdcd29 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address, { WARN_ON(!virtual_address); WARN_ON(!physical_address); - WARN_ON(!length > 0); + WARN_ON(!length); WARN_ON(!sgl); sgl->va = virtual_address; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] powerpc: define empty enable_kernel_vsx() when CONFIG_VSX=n
On 09/08/2015 08:13 PM, Michael Ellerman wrote: On Tue, 2015-09-08 at 17:19 -0600, Tim Gardner wrote: On 09/08/2015 04:47 PM, Paul Mackerras wrote: On Tue, Sep 08, 2015 at 12:13:11PM -0600, tim.gard...@canonical.com wrote: From: Tim Gardner commit 72cd7b44bc99 ("powerpc: Uncomment and make enable_kernel_vsx() routine available") neglected to define an empty inline replacement for enable_kernel_vsx() when CONFIG_VSX=n. If code that wants to call enable_kernel_vsx() is getting compiled in when CONFIG_VSX=n, that's a worry. Is this patch motivated by an actual compile failure? If so what was the failure? I was having link failures after backporting 'crypto: nx' patches to a 4.2 based kernel. You may have a point in that the upstream Kconfig will not allow those files to be compiled if CONFIG_VSX=n. I will check in my morning if to see if I can reproduce the same link error in mainline. I suspect the problem is the "vmx" crypto actually. $ git grep enable_kernel_vsx drivers/ drivers/crypto/vmx/aes.c: enable_kernel_vsx(); drivers/crypto/vmx/aes.c: enable_kernel_vsx(); drivers/crypto/vmx/aes.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_cbc.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_cbc.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_cbc.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_ctr.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_ctr.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_ctr.c: enable_kernel_vsx(); drivers/crypto/vmx/ghash.c: enable_kernel_vsx(); drivers/crypto/vmx/ghash.c: enable_kernel_vsx(); drivers/crypto/vmx/ghash.c: enable_kernel_vsx(); drivers/crypto/vmx/ghash.c: enable_kernel_vsx(); That appears to all be controlled by CONFIG_CRYPTO_DEV_VMX_ENCRYPT, which depends on CONFIG_CRYPTO_DEV_VMX, which depends on PPC64. So that looks like it will break terribly if VSX is turned off. We do have an automated test build with VSX turned off, but it doesn't have CONFIG_CRYPTO_DEV_VMX enabled :/ Having said all that, why are you building a ppc64 kernel with VSX turned off? cheers I'm pretty sure my problem is that I'm building a 32bit powerpc with CONFIG_CRYPTO_DEV_VMX_ENCRYPT=y, though it is hard to tell for sure with the interleaved build output from 4 parallel builds (powerpc-smp powerpc64-smp powerpc-e500mc powerpc64-emb). Your proposed patch ("[PATCH v2] crypto: vmx - VMX crypto should depend on CONFIG_VSX") fixes my problems (and makes more sense then my patch), so I suddenly don't care as much. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] powerpc: define empty enable_kernel_vsx() when CONFIG_VSX=n
On 09/08/2015 08:13 PM, Michael Ellerman wrote: On Tue, 2015-09-08 at 17:19 -0600, Tim Gardner wrote: On 09/08/2015 04:47 PM, Paul Mackerras wrote: On Tue, Sep 08, 2015 at 12:13:11PM -0600, tim.gard...@canonical.com wrote: From: Tim Gardner <tim.gard...@canonical.com> commit 72cd7b44bc99 ("powerpc: Uncomment and make enable_kernel_vsx() routine available") neglected to define an empty inline replacement for enable_kernel_vsx() when CONFIG_VSX=n. If code that wants to call enable_kernel_vsx() is getting compiled in when CONFIG_VSX=n, that's a worry. Is this patch motivated by an actual compile failure? If so what was the failure? I was having link failures after backporting 'crypto: nx' patches to a 4.2 based kernel. You may have a point in that the upstream Kconfig will not allow those files to be compiled if CONFIG_VSX=n. I will check in my morning if to see if I can reproduce the same link error in mainline. I suspect the problem is the "vmx" crypto actually. $ git grep enable_kernel_vsx drivers/ drivers/crypto/vmx/aes.c: enable_kernel_vsx(); drivers/crypto/vmx/aes.c: enable_kernel_vsx(); drivers/crypto/vmx/aes.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_cbc.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_cbc.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_cbc.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_ctr.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_ctr.c: enable_kernel_vsx(); drivers/crypto/vmx/aes_ctr.c: enable_kernel_vsx(); drivers/crypto/vmx/ghash.c: enable_kernel_vsx(); drivers/crypto/vmx/ghash.c: enable_kernel_vsx(); drivers/crypto/vmx/ghash.c: enable_kernel_vsx(); drivers/crypto/vmx/ghash.c: enable_kernel_vsx(); That appears to all be controlled by CONFIG_CRYPTO_DEV_VMX_ENCRYPT, which depends on CONFIG_CRYPTO_DEV_VMX, which depends on PPC64. So that looks like it will break terribly if VSX is turned off. We do have an automated test build with VSX turned off, but it doesn't have CONFIG_CRYPTO_DEV_VMX enabled :/ Having said all that, why are you building a ppc64 kernel with VSX turned off? cheers I'm pretty sure my problem is that I'm building a 32bit powerpc with CONFIG_CRYPTO_DEV_VMX_ENCRYPT=y, though it is hard to tell for sure with the interleaved build output from 4 parallel builds (powerpc-smp powerpc64-smp powerpc-e500mc powerpc64-emb). Your proposed patch ("[PATCH v2] crypto: vmx - VMX crypto should depend on CONFIG_VSX") fixes my problems (and makes more sense then my patch), so I suddenly don't care as much. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] powerpc: define empty enable_kernel_vsx() when CONFIG_VSX=n
On 09/08/2015 04:47 PM, Paul Mackerras wrote: > On Tue, Sep 08, 2015 at 12:13:11PM -0600, tim.gard...@canonical.com wrote: >> From: Tim Gardner >> >> commit 72cd7b44bc99 ("powerpc: Uncomment and make enable_kernel_vsx() >> routine available") neglected to define an empty inline replacement for >> enable_kernel_vsx() when CONFIG_VSX=n. > > If code that wants to call enable_kernel_vsx() is getting compiled in > when CONFIG_VSX=n, that's a worry. Is this patch motivated by an > actual compile failure? If so what was the failure? > > Paul. > I was having link failures after backporting 'crypto: nx' patches to a 4.2 based kernel. You may have a point in that the upstream Kconfig will not allow those files to be compiled if CONFIG_VSX=n. I will check in my morning if to see if I can reproduce the same link error in mainline. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] powerpc: define empty enable_kernel_vsx() when CONFIG_VSX=n
From: Tim Gardner commit 72cd7b44bc99 ("powerpc: Uncomment and make enable_kernel_vsx() routine available") neglected to define an empty inline replacement for enable_kernel_vsx() when CONFIG_VSX=n. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Leonidas Da Silva Barbosa Cc: Herbert Xu Signed-off-by: Tim Gardner --- arch/powerpc/include/asm/switch_to.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h index 15cca17..dea61a0 100644 --- a/arch/powerpc/include/asm/switch_to.h +++ b/arch/powerpc/include/asm/switch_to.h @@ -29,7 +29,6 @@ static inline void save_early_sprs(struct thread_struct *prev) {} extern void enable_kernel_fp(void); extern void enable_kernel_altivec(void); -extern void enable_kernel_vsx(void); extern int emulate_altivec(struct pt_regs *); extern void __giveup_vsx(struct task_struct *); extern void giveup_vsx(struct task_struct *); @@ -69,10 +68,14 @@ static inline void giveup_altivec(struct task_struct *t) #ifdef CONFIG_VSX extern void flush_vsx_to_thread(struct task_struct *); +extern void enable_kernel_vsx(void); #else static inline void flush_vsx_to_thread(struct task_struct *t) { } +static inline void enable_kernel_vsx(void) +{ +} #endif #ifdef CONFIG_SPE -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] powerpc: define empty enable_kernel_vsx() when CONFIG_VSX=n
On 09/08/2015 04:47 PM, Paul Mackerras wrote: > On Tue, Sep 08, 2015 at 12:13:11PM -0600, tim.gard...@canonical.com wrote: >> From: Tim Gardner <tim.gard...@canonical.com> >> >> commit 72cd7b44bc99 ("powerpc: Uncomment and make enable_kernel_vsx() >> routine available") neglected to define an empty inline replacement for >> enable_kernel_vsx() when CONFIG_VSX=n. > > If code that wants to call enable_kernel_vsx() is getting compiled in > when CONFIG_VSX=n, that's a worry. Is this patch motivated by an > actual compile failure? If so what was the failure? > > Paul. > I was having link failures after backporting 'crypto: nx' patches to a 4.2 based kernel. You may have a point in that the upstream Kconfig will not allow those files to be compiled if CONFIG_VSX=n. I will check in my morning if to see if I can reproduce the same link error in mainline. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] powerpc: define empty enable_kernel_vsx() when CONFIG_VSX=n
From: Tim Gardner <tim.gard...@canonical.com> commit 72cd7b44bc99 ("powerpc: Uncomment and make enable_kernel_vsx() routine available") neglected to define an empty inline replacement for enable_kernel_vsx() when CONFIG_VSX=n. Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> Cc: Paul Mackerras <pau...@samba.org> Cc: Michael Ellerman <m...@ellerman.id.au> Cc: Leonidas Da Silva Barbosa <leosi...@linux.vnet.ibm.com> Cc: Herbert Xu <herb...@gondor.apana.org.au> Signed-off-by: Tim Gardner <tim.gard...@canonical.com> --- arch/powerpc/include/asm/switch_to.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h index 15cca17..dea61a0 100644 --- a/arch/powerpc/include/asm/switch_to.h +++ b/arch/powerpc/include/asm/switch_to.h @@ -29,7 +29,6 @@ static inline void save_early_sprs(struct thread_struct *prev) {} extern void enable_kernel_fp(void); extern void enable_kernel_altivec(void); -extern void enable_kernel_vsx(void); extern int emulate_altivec(struct pt_regs *); extern void __giveup_vsx(struct task_struct *); extern void giveup_vsx(struct task_struct *); @@ -69,10 +68,14 @@ static inline void giveup_altivec(struct task_struct *t) #ifdef CONFIG_VSX extern void flush_vsx_to_thread(struct task_struct *); +extern void enable_kernel_vsx(void); #else static inline void flush_vsx_to_thread(struct task_struct *t) { } +static inline void enable_kernel_vsx(void) +{ +} #endif #ifdef CONFIG_SPE -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4.2-rc5] workqueue: Make flush_workqueue() available again to non GPL modules
From: Tim Gardner Commit 37b1ef31a568fc02e53587620226e5f3c66454c8 ("workqueue: move flush_scheduled_work() to workqueue.h") moved the exported non GPL flush_scheduled_work() from a function to an inline wrapper. Unfortunately, it directly calls flush_workqueue() which is a GPL function. This has the effect of changing the licensing requirement for this function and makes it unavailable to non GPL modules. See commit ad7b1f841f8a54c6d61ff181451f55b68175e15a ("workqueue: Make schedule_work() available again to non GPL modules") for precedent. Cc: Tejun Heo Signed-off-by: Tim Gardner --- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 4c4f061..a413acb 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2614,7 +2614,7 @@ void flush_workqueue(struct workqueue_struct *wq) out_unlock: mutex_unlock(>mutex); } -EXPORT_SYMBOL_GPL(flush_workqueue); +EXPORT_SYMBOL(flush_workqueue); /** * drain_workqueue - drain a workqueue -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4.2-rc5] workqueue: Make flush_workqueue() available again to non GPL modules
From: Tim Gardner tim.gard...@canonical.com Commit 37b1ef31a568fc02e53587620226e5f3c66454c8 (workqueue: move flush_scheduled_work() to workqueue.h) moved the exported non GPL flush_scheduled_work() from a function to an inline wrapper. Unfortunately, it directly calls flush_workqueue() which is a GPL function. This has the effect of changing the licensing requirement for this function and makes it unavailable to non GPL modules. See commit ad7b1f841f8a54c6d61ff181451f55b68175e15a (workqueue: Make schedule_work() available again to non GPL modules) for precedent. Cc: Tejun Heo t...@kernel.org Signed-off-by: Tim Gardner tim.gard...@canonical.com --- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 4c4f061..a413acb 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2614,7 +2614,7 @@ void flush_workqueue(struct workqueue_struct *wq) out_unlock: mutex_unlock(wq-mutex); } -EXPORT_SYMBOL_GPL(flush_workqueue); +EXPORT_SYMBOL(flush_workqueue); /** * drain_workqueue - drain a workqueue -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [4.2-rc3] macintosh/ans-lcd.c: Missing include causes compile failure
On 07/23/2015 04:18 AM, Michael Ellerman wrote: On Mon, 2015-20-07 at 19:01:42 UTC, Tim Gardner wrote: From: Tim Gardner drivers/macintosh/ans-lcd.c:201:1: warning: data definition has no type or storage class module_init(anslcd_init); ^ drivers/macintosh/ans-lcd.c:201:1: error: type defaults to 'int' in declaration of 'module_init' [-Werror=implicit-int] gcc version 4.9.3 (Ubuntu 4.9.3-1ubuntu1) Thanks Tim but Luis beat you to it: http://patchwork.ozlabs.org/patch/497138/ I'll send the fix to Linus in the next day or two. cheers No problem. It looks like a better fix then mine anyway. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [4.2-rc3] macintosh/ans-lcd.c: Missing include causes compile failure
On 07/23/2015 04:18 AM, Michael Ellerman wrote: On Mon, 2015-20-07 at 19:01:42 UTC, Tim Gardner wrote: From: Tim Gardner tim.gard...@canonical.com drivers/macintosh/ans-lcd.c:201:1: warning: data definition has no type or storage class module_init(anslcd_init); ^ drivers/macintosh/ans-lcd.c:201:1: error: type defaults to 'int' in declaration of 'module_init' [-Werror=implicit-int] gcc version 4.9.3 (Ubuntu 4.9.3-1ubuntu1) Thanks Tim but Luis beat you to it: http://patchwork.ozlabs.org/patch/497138/ I'll send the fix to Linus in the next day or two. cheers No problem. It looks like a better fix then mine anyway. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4.2-rc3] macintosh/ans-lcd.c: Missing include causes compile failure
From: Tim Gardner drivers/macintosh/ans-lcd.c:201:1: warning: data definition has no type or storage class module_init(anslcd_init); ^ drivers/macintosh/ans-lcd.c:201:1: error: type defaults to 'int' in declaration of 'module_init' [-Werror=implicit-int] gcc version 4.9.3 (Ubuntu 4.9.3-1ubuntu1) Cc: Benjamin Herrenschmidt Signed-off-by: Tim Gardner --- This is a compile regression from v4.2-rc2 drivers/macintosh/ans-lcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c index 1a57e88..36a0047 100644 --- a/drivers/macintosh/ans-lcd.c +++ b/drivers/macintosh/ans-lcd.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4.2-rc3] macintosh/ans-lcd.c: Missing include causes compile failure
From: Tim Gardner tim.gard...@canonical.com drivers/macintosh/ans-lcd.c:201:1: warning: data definition has no type or storage class module_init(anslcd_init); ^ drivers/macintosh/ans-lcd.c:201:1: error: type defaults to 'int' in declaration of 'module_init' [-Werror=implicit-int] gcc version 4.9.3 (Ubuntu 4.9.3-1ubuntu1) Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Tim Gardner tim.gard...@canonical.com --- This is a compile regression from v4.2-rc2 drivers/macintosh/ans-lcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c index 1a57e88..36a0047 100644 --- a/drivers/macintosh/ans-lcd.c +++ b/drivers/macintosh/ans-lcd.c @@ -5,6 +5,7 @@ #include linux/types.h #include linux/errno.h #include linux/kernel.h +#include linux/module.h #include linux/miscdevice.h #include linux/fcntl.h #include linux/init.h -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.17-rc5] kconfig: Suppress warning: ‘jump’ may be used uninitialized
From: Tim Gardner In file included from scripts/kconfig/zconf.tab.c:2537:0: scripts/kconfig/menu.c: In function ‘get_symbol_str’: scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized] jump->offset = strlen(r->s); ^ scripts/kconfig/menu.c:551:19: note: ‘jump’ was declared here struct jump_key *jump; ^ HOSTLD scripts/kconfig/conf gcc 4.9.1 Cc: "Yann E. MORIN" Signed-off-by: Tim Gardner --- Is gcc 4.9 dumber then 4.8 ? gcc 4.8 doesn't produce this warning. scripts/kconfig/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index a26cc5d..584e0fc 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, { int i, j; struct menu *submenu[8], *menu, *location = NULL; - struct jump_key *jump; + struct jump_key *jump = NULL; str_printf(r, _("Prompt: %s\n"), _(prop->text)); menu = prop->menu->parent; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.17-rc5 ] scripts/sortextable: Suppress warning: ‘relocs_size’ may be used uninitialized
From: Tim Gardner In file included from scripts/sortextable.c:194:0: scripts/sortextable.c: In function ‘main’: scripts/sortextable.h:176:3: warning: ‘relocs_size’ may be used uninitialized in this function [-Wmaybe-uninitialized] memset(relocs, 0, relocs_size); ^ scripts/sortextable.h:106:6: note: ‘relocs_size’ was declared here int relocs_size; ^ In file included from scripts/sortextable.c:192:0: scripts/sortextable.h:176:3: warning: ‘relocs_size’ may be used uninitialized in this function [-Wmaybe-uninitialized] memset(relocs, 0, relocs_size); ^ scripts/sortextable.h:106:6: note: ‘relocs_size’ was declared here int relocs_size; ^ gcc 4.9.1 Cc: Andrew Morton Cc: Jamie Iles Signed-off-by: Tim Gardner --- Is gcc 4.9 dumber then 4.8 ? gcc 4.8 doesn't produce this warning. scripts/sortextable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sortextable.h b/scripts/sortextable.h index 8fac3fd..ba87004 100644 --- a/scripts/sortextable.h +++ b/scripts/sortextable.h @@ -103,7 +103,7 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) Elf_Sym *sort_needed_sym; Elf_Shdr *sort_needed_sec; Elf_Rel *relocs = NULL; - int relocs_size; + int relocs_size = 0; uint32_t *sort_done_location; const char *secstrtab; const char *strtab; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [3.13.y.z extended stable] Linux 3.13.11.7 stable review
On 09/15/2014 07:26 PM, Greg KH wrote: > On Mon, Sep 15, 2014 at 07:18:35PM -0600, Tim Gardner wrote: >> On 09/15/2014 06:03 PM, Greg KH wrote: >>> On Mon, Sep 15, 2014 at 03:06:50PM -0700, Kamal Mostafa wrote: >>>> This is the start of the review cycle for the Linux 3.13.11.7 stable >>>> kernel. >>>> >>>> This version contains 187 new patches, summarized below. The new patches >>>> are >>>> posted as replies to this message and also available in this git branch: >>>> >>>> http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=linux-3.13.y-review;a=shortlog >>>> >>>> git://kernel.ubuntu.com/ubuntu/linux.git linux-3.13.y-review >>>> >>>> The review period for version 3.13.11.7 will be open for the next three >>>> days. >>>> To report a problem, please reply to the relevant follow-up patch message. >>> >>> As I asked before, please change the name to not be x.y, it is confusing >>> for lots of people. >>> >>> Use the "normal" way of naming kernel releases, pick a few character >>> naming scheme please. >>> >> >> I think what Kamal said is that he would consider your request. I, >> however, don't think it wise to change version schemes mid-stream in an >> established series. > > Even if that "established series" is the thing that is causing > complaints? > >> Can you provide hard evidence that this version scheme is confusing lots >> of people ? I'm only aware of one complaint voiced by Peter Anvin at the >> kernel summit (http://lwn.net/Articles/608917/). > > Peter's complaint is one that I know of that is in the public record. > > So is mine. > > How many others do you need? > This is a seriously silly argument over an _opinion_ of what is "confusing", and so far I am not feeling moved by the number of contrary opinions. Our version scheme makes sense from a Debian perspective in that it indicates exactly when the Canonical branch was started. It also has the advantage of being distinguishable from the kernel.org version. I _want_ the consumer to be aware of where they have acquired their kernel sources (as if the git URL is insufficient). Frankly, if the version is an _enduring_ source of confusion, then perhaps the consumer should seek other endeavors. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [3.13.y.z extended stable] Linux 3.13.11.7 stable review
On 09/15/2014 07:26 PM, Greg KH wrote: On Mon, Sep 15, 2014 at 07:18:35PM -0600, Tim Gardner wrote: On 09/15/2014 06:03 PM, Greg KH wrote: On Mon, Sep 15, 2014 at 03:06:50PM -0700, Kamal Mostafa wrote: This is the start of the review cycle for the Linux 3.13.11.7 stable kernel. This version contains 187 new patches, summarized below. The new patches are posted as replies to this message and also available in this git branch: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=linux-3.13.y-review;a=shortlog git://kernel.ubuntu.com/ubuntu/linux.git linux-3.13.y-review The review period for version 3.13.11.7 will be open for the next three days. To report a problem, please reply to the relevant follow-up patch message. As I asked before, please change the name to not be x.y, it is confusing for lots of people. Use the normal way of naming kernel releases, pick a few character naming scheme please. I think what Kamal said is that he would consider your request. I, however, don't think it wise to change version schemes mid-stream in an established series. Even if that established series is the thing that is causing complaints? Can you provide hard evidence that this version scheme is confusing lots of people ? I'm only aware of one complaint voiced by Peter Anvin at the kernel summit (http://lwn.net/Articles/608917/). Peter's complaint is one that I know of that is in the public record. So is mine. How many others do you need? This is a seriously silly argument over an _opinion_ of what is confusing, and so far I am not feeling moved by the number of contrary opinions. Our version scheme makes sense from a Debian perspective in that it indicates exactly when the Canonical branch was started. It also has the advantage of being distinguishable from the kernel.org version. I _want_ the consumer to be aware of where they have acquired their kernel sources (as if the git URL is insufficient). Frankly, if the version is an _enduring_ source of confusion, then perhaps the consumer should seek other endeavors. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.17-rc5 ] scripts/sortextable: Suppress warning: ‘relocs_size’ may be used uninitialized
From: Tim Gardner tim.gard...@canonical.com In file included from scripts/sortextable.c:194:0: scripts/sortextable.c: In function ‘main’: scripts/sortextable.h:176:3: warning: ‘relocs_size’ may be used uninitialized in this function [-Wmaybe-uninitialized] memset(relocs, 0, relocs_size); ^ scripts/sortextable.h:106:6: note: ‘relocs_size’ was declared here int relocs_size; ^ In file included from scripts/sortextable.c:192:0: scripts/sortextable.h:176:3: warning: ‘relocs_size’ may be used uninitialized in this function [-Wmaybe-uninitialized] memset(relocs, 0, relocs_size); ^ scripts/sortextable.h:106:6: note: ‘relocs_size’ was declared here int relocs_size; ^ gcc 4.9.1 Cc: Andrew Morton a...@linux-foundation.org Cc: Jamie Iles jamie.i...@oracle.com Signed-off-by: Tim Gardner tim.gard...@canonical.com --- Is gcc 4.9 dumber then 4.8 ? gcc 4.8 doesn't produce this warning. scripts/sortextable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sortextable.h b/scripts/sortextable.h index 8fac3fd..ba87004 100644 --- a/scripts/sortextable.h +++ b/scripts/sortextable.h @@ -103,7 +103,7 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) Elf_Sym *sort_needed_sym; Elf_Shdr *sort_needed_sec; Elf_Rel *relocs = NULL; - int relocs_size; + int relocs_size = 0; uint32_t *sort_done_location; const char *secstrtab; const char *strtab; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.17-rc5] kconfig: Suppress warning: ‘jump’ may be used uninitialized
From: Tim Gardner tim.gard...@canonical.com In file included from scripts/kconfig/zconf.tab.c:2537:0: scripts/kconfig/menu.c: In function ‘get_symbol_str’: scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized] jump-offset = strlen(r-s); ^ scripts/kconfig/menu.c:551:19: note: ‘jump’ was declared here struct jump_key *jump; ^ HOSTLD scripts/kconfig/conf gcc 4.9.1 Cc: Yann E. MORIN yann.morin.1...@free.fr Signed-off-by: Tim Gardner tim.gard...@canonical.com --- Is gcc 4.9 dumber then 4.8 ? gcc 4.8 doesn't produce this warning. scripts/kconfig/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index a26cc5d..584e0fc 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, { int i, j; struct menu *submenu[8], *menu, *location = NULL; - struct jump_key *jump; + struct jump_key *jump = NULL; str_printf(r, _(Prompt: %s\n), _(prop-text)); menu = prop-menu-parent; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [3.13.y.z extended stable] Linux 3.13.11.7 stable review
On 09/15/2014 06:03 PM, Greg KH wrote: > On Mon, Sep 15, 2014 at 03:06:50PM -0700, Kamal Mostafa wrote: >> This is the start of the review cycle for the Linux 3.13.11.7 stable kernel. >> >> This version contains 187 new patches, summarized below. The new patches are >> posted as replies to this message and also available in this git branch: >> >> http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=linux-3.13.y-review;a=shortlog >> >> git://kernel.ubuntu.com/ubuntu/linux.git linux-3.13.y-review >> >> The review period for version 3.13.11.7 will be open for the next three days. >> To report a problem, please reply to the relevant follow-up patch message. > > As I asked before, please change the name to not be x.y, it is confusing > for lots of people. > > Use the "normal" way of naming kernel releases, pick a few character > naming scheme please. > I think what Kamal said is that he would consider your request. I, however, don't think it wise to change version schemes mid-stream in an established series. Can you provide hard evidence that this version scheme is confusing lots of people ? I'm only aware of one complaint voiced by Peter Anvin at the kernel summit (http://lwn.net/Articles/608917/). rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [3.13.y.z extended stable] Linux 3.13.11.7 stable review
On 09/15/2014 06:03 PM, Greg KH wrote: On Mon, Sep 15, 2014 at 03:06:50PM -0700, Kamal Mostafa wrote: This is the start of the review cycle for the Linux 3.13.11.7 stable kernel. This version contains 187 new patches, summarized below. The new patches are posted as replies to this message and also available in this git branch: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=linux-3.13.y-review;a=shortlog git://kernel.ubuntu.com/ubuntu/linux.git linux-3.13.y-review The review period for version 3.13.11.7 will be open for the next three days. To report a problem, please reply to the relevant follow-up patch message. As I asked before, please change the name to not be x.y, it is confusing for lots of people. Use the normal way of naming kernel releases, pick a few character naming scheme please. I think what Kamal said is that he would consider your request. I, however, don't think it wise to change version schemes mid-stream in an established series. Can you provide hard evidence that this version scheme is confusing lots of people ? I'm only aware of one complaint voiced by Peter Anvin at the kernel summit (http://lwn.net/Articles/608917/). rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] cpufreq: ppc-corenet-cpu-freq: do_div use quotient
On 06/04/2014 02:32 PM, Ed Swarthout wrote: > 6712d2931933ada259b82f06c03a855b19937074 (cpufreq: > ppc-corenet-cpufreq: Fix __udivdi3 modpost error) used the remainder > from do_div instead of the quotient. Fix that and add one to ensure > minimum is met. > > Signed-off-by: Ed Swarthout > --- > drivers/cpufreq/ppc-corenet-cpufreq.c | 9 + > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c > b/drivers/cpufreq/ppc-corenet-cpufreq.c > index 0af618a..3607070 100644 > --- a/drivers/cpufreq/ppc-corenet-cpufreq.c > +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c > @@ -138,7 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy > *policy) > struct cpufreq_frequency_table *table; > struct cpu_data *data; > unsigned int cpu = policy->cpu; > - u64 transition_latency_hz; > + u64 u64temp; > > np = of_get_cpu_node(cpu, NULL); > if (!np) > @@ -206,9 +206,10 @@ static int corenet_cpufreq_cpu_init(struct > cpufreq_policy *policy) > for_each_cpu(i, per_cpu(cpu_mask, cpu)) > per_cpu(cpu_data, i) = data; > > - transition_latency_hz = 12ULL * NSEC_PER_SEC; > - policy->cpuinfo.transition_latency = > - do_div(transition_latency_hz, fsl_get_sys_freq()); > + /* Minimum transition latency is 12 platform clocks */ > + u64temp = 12ULL * NSEC_PER_SEC; > + do_div(u64temp, fsl_get_sys_freq()); > + policy->cpuinfo.transition_latency = u64temp + 1; > > of_node_put(np); > > Whoops, what was I thinking ? You should also add "Cc: sta...@vger.kernel.org # 3.15+" since this patch will likely miss 3.15 final. Acked-by: Tim Gardner -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] cpufreq: ppc-corenet-cpu-freq: do_div use quotient
On 06/04/2014 02:32 PM, Ed Swarthout wrote: 6712d2931933ada259b82f06c03a855b19937074 (cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error) used the remainder from do_div instead of the quotient. Fix that and add one to ensure minimum is met. Signed-off-by: Ed Swarthout ed.swarth...@freescale.com --- drivers/cpufreq/ppc-corenet-cpufreq.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c index 0af618a..3607070 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c @@ -138,7 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) struct cpufreq_frequency_table *table; struct cpu_data *data; unsigned int cpu = policy-cpu; - u64 transition_latency_hz; + u64 u64temp; np = of_get_cpu_node(cpu, NULL); if (!np) @@ -206,9 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) for_each_cpu(i, per_cpu(cpu_mask, cpu)) per_cpu(cpu_data, i) = data; - transition_latency_hz = 12ULL * NSEC_PER_SEC; - policy-cpuinfo.transition_latency = - do_div(transition_latency_hz, fsl_get_sys_freq()); + /* Minimum transition latency is 12 platform clocks */ + u64temp = 12ULL * NSEC_PER_SEC; + do_div(u64temp, fsl_get_sys_freq()); + policy-cpuinfo.transition_latency = u64temp + 1; of_node_put(np); Whoops, what was I thinking ? You should also add Cc: sta...@vger.kernel.org # 3.15+ since this patch will likely miss 3.15 final. Acked-by: Tim Gardner tim.gard...@canonical.com -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Lenovo x120e resume regression in 3.15-rc1 bisected to 'drm/crtc-helpers: fix dpms on logic'
On 05/02/2014 12:30 PM, Tim Gardner wrote: > On 05/02/2014 11:21 AM, Alex Deucher wrote: >> On Fri, May 2, 2014 at 12:40 PM, Tim Gardner >> wrote: >>> I've bisected a resume regression on a Lenovo x120e to >>> 177cf92de4aa97ec1435987e91696ed8b5023130 (drm/crtc-helpers: fix dpms on >>> logic). Everything works fine with this patch reverted on top of >>> 3.15-rc3. I realize it is correcting a coding error that has been in >>> place since 3.11, but it is also causing this laptop to resume to a >>> black screen wherein the platform appears to be locked up (no console, >>> no network). See attached bisect log and lspci. The BIOS version is 1.15. >>> >> >> Does the attached patch help? I haven't had a chance to unwind all >> the logic in the crtc helper code. >> >> Alex >> > > Nope, same symptom. Black screen on resume, no network, etc. > > rtg > linux-next tip (20140502) appears to have the same bug. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Lenovo x120e resume regression in 3.15-rc1 bisected to 'drm/crtc-helpers: fix dpms on logic'
On 05/02/2014 11:21 AM, Alex Deucher wrote: > On Fri, May 2, 2014 at 12:40 PM, Tim Gardner > wrote: >> I've bisected a resume regression on a Lenovo x120e to >> 177cf92de4aa97ec1435987e91696ed8b5023130 (drm/crtc-helpers: fix dpms on >> logic). Everything works fine with this patch reverted on top of >> 3.15-rc3. I realize it is correcting a coding error that has been in >> place since 3.11, but it is also causing this laptop to resume to a >> black screen wherein the platform appears to be locked up (no console, >> no network). See attached bisect log and lspci. The BIOS version is 1.15. >> > > Does the attached patch help? I haven't had a chance to unwind all > the logic in the crtc helper code. > > Alex > Nope, same symptom. Black screen on resume, no network, etc. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Lenovo x120e resume regression in 3.15-rc1 bisected to 'drm/crtc-helpers: fix dpms on logic'
I've bisected a resume regression on a Lenovo x120e to 177cf92de4aa97ec1435987e91696ed8b5023130 (drm/crtc-helpers: fix dpms on logic). Everything works fine with this patch reverted on top of 3.15-rc3. I realize it is correcting a coding error that has been in place since 3.11, but it is also causing this laptop to resume to a black screen wherein the platform appears to be locked up (no console, no network). See attached bisect log and lspci. The BIOS version is 1.15. rtg -- Tim Gardner tim.gard...@canonical.com # bad: [c9eaa447e77efe77b7fa4c953bd62de8297fd6c5] Linux 3.15-rc1 # good: [455c6fdbd219161bd09b1165f11699d6d73de11c] Linux 3.14 git bisect start 'v3.15-rc1' 'v3.14' '--' 'drivers/gpu/' # good: [e19b9137142988bec5a76c5f8bdf12a77ea802b0] Merge remote-tracking branch 'airlied/drm-next' into drm-intel-next git bisect good e19b9137142988bec5a76c5f8bdf12a77ea802b0 # good: [0d3215e3857ab679f74c9b26b7e711955c9d0438] drm/ttm: Add a ttm_ref_object_exists function git bisect good 0d3215e3857ab679f74c9b26b7e711955c9d0438 # good: [efbc20abd826033859cc28d1442e48640cf09045] drm/i915: don't read pp_ctrl_reg if we're suspended git bisect good efbc20abd826033859cc28d1442e48640cf09045 # bad: [14c6d5bdf759274868c6a3534e56f1991118df63] Merge tag 'vmwgfx-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux into drm-next git bisect bad 14c6d5bdf759274868c6a3534e56f1991118df63 # bad: [a8947f576728a66bd3aac629bd8ca021a010c808] drm/radeon: fix endian swap on hawaii clear state buffer setup git bisect bad a8947f576728a66bd3aac629bd8ca021a010c808 # good: [2d82d188b2cb11b6b221eb84dda2344ef3cd1bb4] drm/msm: Switch to universal plane API's git bisect good 2d82d188b2cb11b6b221eb84dda2344ef3cd1bb4 # bad: [2844ea3f252331cc0ecf3ae74f6226db2f580f8a] Merge branch 'primary-plane' of git://people.freedesktop.org/~robclark/linux into drm-next git bisect bad 2844ea3f252331cc0ecf3ae74f6226db2f580f8a # bad: [177cf92de4aa97ec1435987e91696ed8b5023130] drm/crtc-helpers: fix dpms on logic git bisect bad 177cf92de4aa97ec1435987e91696ed8b5023130 # good: [41ccec352f3c823931a7d9d2a9c7880c14d7415a] drm/qxl: unset a pointer in sync_obj_unref git bisect good 41ccec352f3c823931a7d9d2a9c7880c14d7415a # first bad commit: [177cf92de4aa97ec1435987e91696ed8b5023130] drm/crtc-helpers: fix dpms on logic 00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 14h Processor Root Complex [1022:1510] Subsystem: Advanced Micro Devices, Inc. [AMD] Family 14h Processor Root Complex [1022:1510] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- SERR- TAbort- SERR- [disabled] Capabilities: Kernel driver in use: radeon 00:01.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Wrestler HDMI Audio [1002:1314] Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Wrestler HDMI Audio [1002:1314] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- Kernel driver in use: snd_hda_intel 00:06.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 14h Processor Root Port [1022:1514] (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- TAbort- Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: Kernel driver in use: pcieport 00:11.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] [1002:4391] (prog-if 01 [AHCI 1.0]) Subsystem: Lenovo Device [17aa:21df] Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- SERR- Kernel driver in use: ahci 00:12.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller [1002:4397] (prog-if 10 [OHCI]) Subsystem: Lenovo Device [17aa:21df] Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- SERR- TAbort- SERR- Kernel driver in use: ehci-pci 00:13.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller [1002:4397] (prog-if 10 [OHCI]) Subsystem: Lenovo Device [17aa:21df] Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- SERR- TAbort- SERR- Kernel d
Lenovo x120e resume regression in 3.15-rc1 bisected to 'drm/crtc-helpers: fix dpms on logic'
I've bisected a resume regression on a Lenovo x120e to 177cf92de4aa97ec1435987e91696ed8b5023130 (drm/crtc-helpers: fix dpms on logic). Everything works fine with this patch reverted on top of 3.15-rc3. I realize it is correcting a coding error that has been in place since 3.11, but it is also causing this laptop to resume to a black screen wherein the platform appears to be locked up (no console, no network). See attached bisect log and lspci. The BIOS version is 1.15. rtg -- Tim Gardner tim.gard...@canonical.com # bad: [c9eaa447e77efe77b7fa4c953bd62de8297fd6c5] Linux 3.15-rc1 # good: [455c6fdbd219161bd09b1165f11699d6d73de11c] Linux 3.14 git bisect start 'v3.15-rc1' 'v3.14' '--' 'drivers/gpu/' # good: [e19b9137142988bec5a76c5f8bdf12a77ea802b0] Merge remote-tracking branch 'airlied/drm-next' into drm-intel-next git bisect good e19b9137142988bec5a76c5f8bdf12a77ea802b0 # good: [0d3215e3857ab679f74c9b26b7e711955c9d0438] drm/ttm: Add a ttm_ref_object_exists function git bisect good 0d3215e3857ab679f74c9b26b7e711955c9d0438 # good: [efbc20abd826033859cc28d1442e48640cf09045] drm/i915: don't read pp_ctrl_reg if we're suspended git bisect good efbc20abd826033859cc28d1442e48640cf09045 # bad: [14c6d5bdf759274868c6a3534e56f1991118df63] Merge tag 'vmwgfx-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux into drm-next git bisect bad 14c6d5bdf759274868c6a3534e56f1991118df63 # bad: [a8947f576728a66bd3aac629bd8ca021a010c808] drm/radeon: fix endian swap on hawaii clear state buffer setup git bisect bad a8947f576728a66bd3aac629bd8ca021a010c808 # good: [2d82d188b2cb11b6b221eb84dda2344ef3cd1bb4] drm/msm: Switch to universal plane API's git bisect good 2d82d188b2cb11b6b221eb84dda2344ef3cd1bb4 # bad: [2844ea3f252331cc0ecf3ae74f6226db2f580f8a] Merge branch 'primary-plane' of git://people.freedesktop.org/~robclark/linux into drm-next git bisect bad 2844ea3f252331cc0ecf3ae74f6226db2f580f8a # bad: [177cf92de4aa97ec1435987e91696ed8b5023130] drm/crtc-helpers: fix dpms on logic git bisect bad 177cf92de4aa97ec1435987e91696ed8b5023130 # good: [41ccec352f3c823931a7d9d2a9c7880c14d7415a] drm/qxl: unset a pointer in sync_obj_unref git bisect good 41ccec352f3c823931a7d9d2a9c7880c14d7415a # first bad commit: [177cf92de4aa97ec1435987e91696ed8b5023130] drm/crtc-helpers: fix dpms on logic 00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 14h Processor Root Complex [1022:1510] Subsystem: Advanced Micro Devices, Inc. [AMD] Family 14h Processor Root Complex [1022:1510] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium TAbort- TAbort- MAbort- SERR- PERR- INTx- Latency: 64 00:01.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Wrestler [Radeon HD 6310] [1002:9802] (prog-if 00 [VGA controller]) Subsystem: Lenovo Device [17aa:21df] Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast TAbort- TAbort- MAbort- SERR- PERR- INTx- Latency: 0, Cache Line Size: 32 bytes Interrupt: pin A routed to IRQ 43 Region 0: Memory at e000 (32-bit, prefetchable) [size=256M] Region 1: I/O ports at 4000 [size=256] Region 2: Memory at f020 (32-bit, non-prefetchable) [size=256K] Expansion ROM at unassigned [disabled] Capabilities: access denied Kernel driver in use: radeon 00:01.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Wrestler HDMI Audio [1002:1314] Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Wrestler HDMI Audio [1002:1314] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast TAbort- TAbort- MAbort- SERR- PERR- INTx- Latency: 0, Cache Line Size: 32 bytes Interrupt: pin B routed to IRQ 45 Region 0: Memory at f0244000 (32-bit, non-prefetchable) [size=16K] Capabilities: access denied Kernel driver in use: snd_hda_intel 00:06.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 14h Processor Root Port [1022:1514] (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast TAbort- TAbort- MAbort- SERR- PERR- INTx- Latency: 0, Cache Line Size: 32 bytes Bus: primary=00, secondary=01, subordinate=01, sec-latency=0 I/O behind bridge: 3000-3fff Memory behind bridge: f030-f03f Prefetchable memory behind bridge: f000-f00f Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast TAbort- TAbort- MAbort- SERR- PERR- BridgeCtl: Parity- SERR
Re: Lenovo x120e resume regression in 3.15-rc1 bisected to 'drm/crtc-helpers: fix dpms on logic'
On 05/02/2014 11:21 AM, Alex Deucher wrote: On Fri, May 2, 2014 at 12:40 PM, Tim Gardner tim.gard...@canonical.com wrote: I've bisected a resume regression on a Lenovo x120e to 177cf92de4aa97ec1435987e91696ed8b5023130 (drm/crtc-helpers: fix dpms on logic). Everything works fine with this patch reverted on top of 3.15-rc3. I realize it is correcting a coding error that has been in place since 3.11, but it is also causing this laptop to resume to a black screen wherein the platform appears to be locked up (no console, no network). See attached bisect log and lspci. The BIOS version is 1.15. Does the attached patch help? I haven't had a chance to unwind all the logic in the crtc helper code. Alex Nope, same symptom. Black screen on resume, no network, etc. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Lenovo x120e resume regression in 3.15-rc1 bisected to 'drm/crtc-helpers: fix dpms on logic'
On 05/02/2014 12:30 PM, Tim Gardner wrote: On 05/02/2014 11:21 AM, Alex Deucher wrote: On Fri, May 2, 2014 at 12:40 PM, Tim Gardner tim.gard...@canonical.com wrote: I've bisected a resume regression on a Lenovo x120e to 177cf92de4aa97ec1435987e91696ed8b5023130 (drm/crtc-helpers: fix dpms on logic). Everything works fine with this patch reverted on top of 3.15-rc3. I realize it is correcting a coding error that has been in place since 3.11, but it is also causing this laptop to resume to a black screen wherein the platform appears to be locked up (no console, no network). See attached bisect log and lspci. The BIOS version is 1.15. Does the attached patch help? I haven't had a chance to unwind all the logic in the crtc helper code. Alex Nope, same symptom. Black screen on resume, no network, etc. rtg linux-next tip (20140502) appears to have the same bug. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.15-rc3] cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error
bfa709bc823fc32ee8dd5220d1711b46078235d8 (cpufreq: powerpc: add cpufreq transition latency for FSL e500mc SoCs) introduced a modpost error: ERROR: "__udivdi3" [drivers/cpufreq/ppc-corenet-cpufreq.ko] undefined! make[1]: *** [__modpost] Error 1 Fix this by avoiding 64 bit integer division. gcc version 4.8.2 Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: Zhuoyu Zhang Signed-off-by: Tim Gardner --- drivers/cpufreq/ppc-corenet-cpufreq.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c index a1ca3dd..0af618a 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c @@ -138,6 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) struct cpufreq_frequency_table *table; struct cpu_data *data; unsigned int cpu = policy->cpu; + u64 transition_latency_hz; np = of_get_cpu_node(cpu, NULL); if (!np) @@ -205,8 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) for_each_cpu(i, per_cpu(cpu_mask, cpu)) per_cpu(cpu_data, i) = data; + transition_latency_hz = 12ULL * NSEC_PER_SEC; policy->cpuinfo.transition_latency = - (12ULL * NSEC_PER_SEC) / fsl_get_sys_freq(); + do_div(transition_latency_hz, fsl_get_sys_freq()); + of_node_put(np); return 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.15-rc3] cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error
bfa709bc823fc32ee8dd5220d1711b46078235d8 (cpufreq: powerpc: add cpufreq transition latency for FSL e500mc SoCs) introduced a modpost error: ERROR: __udivdi3 [drivers/cpufreq/ppc-corenet-cpufreq.ko] undefined! make[1]: *** [__modpost] Error 1 Fix this by avoiding 64 bit integer division. gcc version 4.8.2 Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Viresh Kumar viresh.ku...@linaro.org Cc: Zhuoyu Zhang zhuoyu.zh...@freescale.com Signed-off-by: Tim Gardner tim.gard...@canonical.com --- drivers/cpufreq/ppc-corenet-cpufreq.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c index a1ca3dd..0af618a 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c @@ -138,6 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) struct cpufreq_frequency_table *table; struct cpu_data *data; unsigned int cpu = policy-cpu; + u64 transition_latency_hz; np = of_get_cpu_node(cpu, NULL); if (!np) @@ -205,8 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) for_each_cpu(i, per_cpu(cpu_mask, cpu)) per_cpu(cpu_data, i) = data; + transition_latency_hz = 12ULL * NSEC_PER_SEC; policy-cpuinfo.transition_latency = - (12ULL * NSEC_PER_SEC) / fsl_get_sys_freq(); + do_div(transition_latency_hz, fsl_get_sys_freq()); + of_node_put(np); return 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH net-next] xprtrdma: rpcrdma_register_default_external: Silence frame size warning
net/sunrpc/xprtrdma/verbs.c: In function 'rpcrdma_register_default_external': net/sunrpc/xprtrdma/verbs.c:1774:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 4.8.2, x86_64-linux-gnu Cc: Trond Myklebust Cc: "J. Bruce Fields" Cc: "David S. Miller" Signed-off-by: Tim Gardner --- net/sunrpc/xprtrdma/verbs.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 93726560..8130349 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -1736,9 +1736,13 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg, int mem_priv = (writing ? IB_ACCESS_REMOTE_WRITE : IB_ACCESS_REMOTE_READ); struct rpcrdma_mr_seg *seg1 = seg; - struct ib_phys_buf ipb[RPCRDMA_MAX_DATA_SEGS]; + struct ib_phys_buf *ipb; int len, i, rc = 0; + ipb = kmalloc(sizeof(*ipb) * RPCRDMA_MAX_DATA_SEGS, GFP_ATOMIC); + if (!ipb) + return -ENOMEM; + if (*nsegs > RPCRDMA_MAX_DATA_SEGS) *nsegs = RPCRDMA_MAX_DATA_SEGS; for (len = 0, i = 0; i < *nsegs;) { @@ -1770,6 +1774,8 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg, seg1->mr_len = len; } *nsegs = i; + + kfree(ipb); return rc; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH net-next] xprtrdma: rpcrdma_register_default_external: Silence frame size warning
On 04/18/2014 01:52 PM, Trond Myklebust wrote: On Fri, Apr 18, 2014 at 3:50 PM, Tim Gardner mailto:tim.gard...@canonical.com>> wrote: net/sunrpc/xprtrdma/verbs.c: In function 'rpcrdma_register_default_external': net/sunrpc/xprtrdma/verbs.c:1774:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 4.8.2, x86_64-linux-gnu Cc: Trond Myklebust mailto:trond.mykleb...@primarydata.com>> Cc: "J. Bruce Fields" mailto:bfie...@fieldses.org>> Cc: "David S. Miller" mailto:da...@davemloft.net>> Signed-off-by: Tim Gardner mailto:tim.gard...@canonical.com>> --- net/sunrpc/xprtrdma/verbs.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 93726560..8130349 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -1736,9 +1736,13 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg, int mem_priv = (writing ? IB_ACCESS_REMOTE_WRITE : IB_ACCESS_REMOTE_READ); struct rpcrdma_mr_seg *seg1 = seg; - struct ib_phys_buf ipb[RPCRDMA_MAX_DATA_SEGS]; + struct ib_phys_buf *ipb; int len, i, rc = 0; + ipb = kmalloc(sizeof(*ipb) * RPCRDMA_MAX_DATA_SEGS, GFP_ATOMIC); + if (!ipb) + return -ENOMEM; + if (*nsegs > RPCRDMA_MAX_DATA_SEGS) *nsegs = RPCRDMA_MAX_DATA_SEGS; for (len = 0, i = 0; i < *nsegs;) { @@ -1770,6 +1774,8 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg, seg1->mr_len = len; } *nsegs = i; + + kfree(ipb); return rc; } -- 1.7.9.5 What has this got to do with net-next? It is RPC related... -- Trond Myklebust Linux NFS client maintainer, PrimaryData trond.mykleb...@primarydata.com <mailto:trond.mykleb...@primarydata.com> I guess I naively thought that anything under the net directory went through Dave's tree. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH net-next] xprtrdma: rpcrdma_register_default_external: Silence frame size warning
On 04/18/2014 01:52 PM, Trond Myklebust wrote: On Fri, Apr 18, 2014 at 3:50 PM, Tim Gardner tim.gard...@canonical.com mailto:tim.gard...@canonical.com wrote: net/sunrpc/xprtrdma/verbs.c: In function 'rpcrdma_register_default_external': net/sunrpc/xprtrdma/verbs.c:1774:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 4.8.2, x86_64-linux-gnu Cc: Trond Myklebust trond.mykleb...@primarydata.com mailto:trond.mykleb...@primarydata.com Cc: J. Bruce Fields bfie...@fieldses.org mailto:bfie...@fieldses.org Cc: David S. Miller da...@davemloft.net mailto:da...@davemloft.net Signed-off-by: Tim Gardner tim.gard...@canonical.com mailto:tim.gard...@canonical.com --- net/sunrpc/xprtrdma/verbs.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 93726560..8130349 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -1736,9 +1736,13 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg, int mem_priv = (writing ? IB_ACCESS_REMOTE_WRITE : IB_ACCESS_REMOTE_READ); struct rpcrdma_mr_seg *seg1 = seg; - struct ib_phys_buf ipb[RPCRDMA_MAX_DATA_SEGS]; + struct ib_phys_buf *ipb; int len, i, rc = 0; + ipb = kmalloc(sizeof(*ipb) * RPCRDMA_MAX_DATA_SEGS, GFP_ATOMIC); + if (!ipb) + return -ENOMEM; + if (*nsegs RPCRDMA_MAX_DATA_SEGS) *nsegs = RPCRDMA_MAX_DATA_SEGS; for (len = 0, i = 0; i *nsegs;) { @@ -1770,6 +1774,8 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg, seg1-mr_len = len; } *nsegs = i; + + kfree(ipb); return rc; } -- 1.7.9.5 What has this got to do with net-next? It is RPC related... -- Trond Myklebust Linux NFS client maintainer, PrimaryData trond.mykleb...@primarydata.com mailto:trond.mykleb...@primarydata.com I guess I naively thought that anything under the net directory went through Dave's tree. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH net-next] xprtrdma: rpcrdma_register_default_external: Silence frame size warning
net/sunrpc/xprtrdma/verbs.c: In function 'rpcrdma_register_default_external': net/sunrpc/xprtrdma/verbs.c:1774:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=] gcc version 4.8.2, x86_64-linux-gnu Cc: Trond Myklebust trond.mykleb...@primarydata.com Cc: J. Bruce Fields bfie...@fieldses.org Cc: David S. Miller da...@davemloft.net Signed-off-by: Tim Gardner tim.gard...@canonical.com --- net/sunrpc/xprtrdma/verbs.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 93726560..8130349 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -1736,9 +1736,13 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg, int mem_priv = (writing ? IB_ACCESS_REMOTE_WRITE : IB_ACCESS_REMOTE_READ); struct rpcrdma_mr_seg *seg1 = seg; - struct ib_phys_buf ipb[RPCRDMA_MAX_DATA_SEGS]; + struct ib_phys_buf *ipb; int len, i, rc = 0; + ipb = kmalloc(sizeof(*ipb) * RPCRDMA_MAX_DATA_SEGS, GFP_ATOMIC); + if (!ipb) + return -ENOMEM; + if (*nsegs RPCRDMA_MAX_DATA_SEGS) *nsegs = RPCRDMA_MAX_DATA_SEGS; for (len = 0, i = 0; i *nsegs;) { @@ -1770,6 +1774,8 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg, seg1-mr_len = len; } *nsegs = i; + + kfree(ipb); return rc; } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 linux-next] ALSA: pcm: 'BUG:' message unnecessarily triggers kerneloops
BugLink: http://bugs.launchpad.net/bugs/1305480 The kerneloops-daemon scans dmesg for common crash signatures, among which is 'BUG:'. The message emitted by the PCM library is really a warning, so the most expedient thing to do seems to be to change the string. Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Mark Brown Cc: Lars-Peter Clausen Cc: JongHo Kim Signed-off-by: Tim Gardner --- v2: Changed string preface from "OVER RUN" to "XRUN". As Takashi pointed out, 'Use a term "XRUN", as it's not always an overrun.' sound/core/pcm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index ce83def..9acc77e 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -345,7 +345,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, snd_pcm_debug_name(substream, name, sizeof(name)); xrun_log_show(substream); pcm_err(substream->pcm, - "BUG: %s, pos = %ld, buffer size = %ld, period size = %ld\n", + "XRUN: %s, pos = %ld, buffer size = %ld, period size = %ld\n", name, pos, runtime->buffer_size, runtime->period_size); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 linux-next] ALSA: pcm: 'BUG:' message unnecessarily triggers kerneloops
BugLink: http://bugs.launchpad.net/bugs/1305480 The kerneloops-daemon scans dmesg for common crash signatures, among which is 'BUG:'. The message emitted by the PCM library is really a warning, so the most expedient thing to do seems to be to change the string. Cc: Jaroslav Kysela pe...@perex.cz Cc: Takashi Iwai ti...@suse.de Cc: Mark Brown broo...@linaro.org Cc: Lars-Peter Clausen l...@metafoo.de Cc: JongHo Kim furmu...@gmail.com Signed-off-by: Tim Gardner tim.gard...@canonical.com --- v2: Changed string preface from OVER RUN to XRUN. As Takashi pointed out, 'Use a term XRUN, as it's not always an overrun.' sound/core/pcm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index ce83def..9acc77e 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -345,7 +345,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, snd_pcm_debug_name(substream, name, sizeof(name)); xrun_log_show(substream); pcm_err(substream-pcm, - BUG: %s, pos = %ld, buffer size = %ld, period size = %ld\n, + XRUN: %s, pos = %ld, buffer size = %ld, period size = %ld\n, name, pos, runtime-buffer_size, runtime-period_size); } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ALSA: pcm: 'BUG:' message unnecessarily triggers kerneloops
BugLink: http://bugs.launchpad.net/bugs/1305480 The kerneloops-daemon scans dmesg for common crash signatures, among which is 'BUG:'. The message emitted by the PCM library is really a warning, so the most expedient thing to do seems to be to change the string. Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Mark Brown Cc: Lars-Peter Clausen Cc: JongHo Kim Signed-off-by: Tim Gardner --- sound/core/pcm_lib.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index ce83def..2a0563d 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -345,7 +345,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, snd_pcm_debug_name(substream, name, sizeof(name)); xrun_log_show(substream); pcm_err(substream->pcm, - "BUG: %s, pos = %ld, buffer size = %ld, period size = %ld\n", + "OVER RUN: %s, pos = %ld, buffer size = %ld, period size = %ld\n", name, pos, runtime->buffer_size, runtime->period_size); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ALSA: pcm: 'BUG:' message unnecessarily triggers kerneloops
BugLink: http://bugs.launchpad.net/bugs/1305480 The kerneloops-daemon scans dmesg for common crash signatures, among which is 'BUG:'. The message emitted by the PCM library is really a warning, so the most expedient thing to do seems to be to change the string. Cc: Jaroslav Kysela pe...@perex.cz Cc: Takashi Iwai ti...@suse.de Cc: Mark Brown broo...@linaro.org Cc: Lars-Peter Clausen l...@metafoo.de Cc: JongHo Kim furmu...@gmail.com Signed-off-by: Tim Gardner tim.gard...@canonical.com --- sound/core/pcm_lib.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index ce83def..2a0563d 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -345,7 +345,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, snd_pcm_debug_name(substream, name, sizeof(name)); xrun_log_show(substream); pcm_err(substream-pcm, - BUG: %s, pos = %ld, buffer size = %ld, period size = %ld\n, + OVER RUN: %s, pos = %ld, buffer size = %ld, period size = %ld\n, name, pos, runtime-buffer_size, runtime-period_size); } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH linux-next] ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb()
BugLink: http://bugs.launchpad.net/bugs/1305133 Malfunctioning or slow devices can cause a flood of dmesg SPAM. I've ignored checkpatch.pl complaints about the use of printk_ratelimit() in favour of prior art in sound/usb/pcm.c. WARNING: Prefer printk_ratelimited or pr__ratelimited to printk_ratelimit + if (printk_ratelimit() && Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Eldad Zack Cc: Daniel Mack Cc: Clemens Ladisch Signed-off-by: Tim Gardner --- sound/usb/pcm.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 49de5c1..131336d 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -1501,7 +1501,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs, * The error should be lower than 2ms since the estimate relies * on two reads of a counter updated every ms. */ - if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) + if (printk_ratelimit() && + abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) dev_dbg(>dev->dev, "delay: estimated %d, actual %d\n", est_delay, subs->last_delay); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH linux-next] ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb()
BugLink: http://bugs.launchpad.net/bugs/1305133 Malfunctioning or slow devices can cause a flood of dmesg SPAM. I've ignored checkpatch.pl complaints about the use of printk_ratelimit() in favour of prior art in sound/usb/pcm.c. WARNING: Prefer printk_ratelimited or pr_level_ratelimited to printk_ratelimit + if (printk_ratelimit() Cc: Jaroslav Kysela pe...@perex.cz Cc: Takashi Iwai ti...@suse.de Cc: Eldad Zack el...@fogrefinery.com Cc: Daniel Mack zon...@gmail.com Cc: Clemens Ladisch clem...@ladisch.de Signed-off-by: Tim Gardner tim.gard...@canonical.com --- sound/usb/pcm.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 49de5c1..131336d 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -1501,7 +1501,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs, * The error should be lower than 2ms since the estimate relies * on two reads of a counter updated every ms. */ - if (abs(est_delay - subs-last_delay) * 1000 runtime-rate * 2) + if (printk_ratelimit() + abs(est_delay - subs-last_delay) * 1000 runtime-rate * 2) dev_dbg(subs-dev-dev, delay: estimated %d, actual %d\n, est_delay, subs-last_delay); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: ahci_platform broken build
Gents - while reviewing some patches for arm64 in Ubuntu I noticed that there is at least one patch sequence in linux-next that breaks the build. 156c5887948cd191417f18026aab9ce26e5a95da ahci-platform: Add support for devices with more then 1 clock 039ece38da45f5e6a94be3aa7611cf3634bc2461 libahci: Allow drivers to override start_engine For example: git reset --hard 156c5887948cd191417f18026aab9ce26e5a95da echo "CONFIG_SATA_AHCI_PLATFORM=y" >> .config make oldconfig scripts prepare make M=drivers/ata WARNING: Symbol version dump /home/rtg/linux/linux-next/Module.symvers is missing; modules will have no dependencies and modversions. CC drivers/ata/libata-core.o CC drivers/ata/libata-scsi.o CC drivers/ata/libata-eh.o CC drivers/ata/libata-transport.o CC drivers/ata/libata-sff.o CC drivers/ata/libata-pmp.o CC drivers/ata/libata-acpi.o LD drivers/ata/libata.o CC drivers/ata/ahci.o CC drivers/ata/libahci.o CC drivers/ata/ahci_platform.o drivers/ata/ahci_platform.c: In function ‘ahci_probe’: drivers/ata/ahci_platform.c:209:2: error: implicit declaration of function ‘ahci_enable_clks’ [-Werror=implicit-function-declaration] drivers/ata/ahci_platform.c:293:2: error: implicit declaration of function ‘ahci_disable_clks’ [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors make[1]: *** [drivers/ata/ahci_platform.o] Error 1 make: *** [_module_drivers/ata] Error 2 The compile problem is then fixed in 96a01ba52c60fdd74dd6e8cf06645d06515b1396 (ahci-platform: Add enable_ / disable_resources helper functions) which is not really kosher. It seems like you ought to fix this before the 3.15 merge window opens. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: ahci_platform broken build
Gents - while reviewing some patches for arm64 in Ubuntu I noticed that there is at least one patch sequence in linux-next that breaks the build. 156c5887948cd191417f18026aab9ce26e5a95da ahci-platform: Add support for devices with more then 1 clock 039ece38da45f5e6a94be3aa7611cf3634bc2461 libahci: Allow drivers to override start_engine For example: git reset --hard 156c5887948cd191417f18026aab9ce26e5a95da echo CONFIG_SATA_AHCI_PLATFORM=y .config make oldconfig scripts prepare make M=drivers/ata WARNING: Symbol version dump /home/rtg/linux/linux-next/Module.symvers is missing; modules will have no dependencies and modversions. CC drivers/ata/libata-core.o CC drivers/ata/libata-scsi.o CC drivers/ata/libata-eh.o CC drivers/ata/libata-transport.o CC drivers/ata/libata-sff.o CC drivers/ata/libata-pmp.o CC drivers/ata/libata-acpi.o LD drivers/ata/libata.o CC drivers/ata/ahci.o CC drivers/ata/libahci.o CC drivers/ata/ahci_platform.o drivers/ata/ahci_platform.c: In function ‘ahci_probe’: drivers/ata/ahci_platform.c:209:2: error: implicit declaration of function ‘ahci_enable_clks’ [-Werror=implicit-function-declaration] drivers/ata/ahci_platform.c:293:2: error: implicit declaration of function ‘ahci_disable_clks’ [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors make[1]: *** [drivers/ata/ahci_platform.o] Error 1 make: *** [_module_drivers/ata] Error 2 The compile problem is then fixed in 96a01ba52c60fdd74dd6e8cf06645d06515b1396 (ahci-platform: Add enable_ / disable_resources helper functions) which is not really kosher. It seems like you ought to fix this before the 3.15 merge window opens. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4 linux-next V3] cifs: rename set_path_size and set_file_size
These 2 method names are a bit confusing. Rename them so that one can tell at a glance how they are to be used. Cc: Steve French Cc: Jeff Layton Cc: Dean Gehnert Signed-off-by: Tim Gardner --- V3 - no change V2 - this is a new patch in the V2 series. fs/cifs/cifsglob.h |4 ++-- fs/cifs/inode.c | 15 +-- fs/cifs/smb1ops.c |6 +++--- fs/cifs/smb2inode.c |2 +- fs/cifs/smb2ops.c | 14 +++--- fs/cifs/smb2proto.h |8 +--- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f918a99..8fd8eb2 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -270,10 +270,10 @@ struct smb_version_operations { struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); /* set size by path */ - int (*set_path_size)(const unsigned int, struct cifs_tcon *, + int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, const char *, __u64, struct cifs_sb_info *, bool); /* set size by file handle */ - int (*set_file_size)(const unsigned int, struct cifs_tcon *, + int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, struct cifsFileInfo *, __u64, bool); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 36f9ebb..7181516 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1925,9 +1925,11 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, if (open_file) { tcon = tlink_tcon(open_file->tlink); server = tcon->ses->server; - if (server->ops->set_file_size) - rc = server->ops->set_file_size(xid, tcon, open_file, - attrs->ia_size, false); + if (server->ops->set_file_size_by_handle) + rc = server->ops->set_file_size_by_handle(xid, tcon, + open_file, + attrs->ia_size, + false); else rc = -ENOSYS; cifsFileInfo_put(open_file); @@ -1963,9 +1965,10 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, * valid, writeable file handle for it was found or because there was * an error setting it by handle. */ - if (server->ops->set_path_size) - rc = server->ops->set_path_size(xid, tcon, full_path, - attrs->ia_size, cifs_sb, false); + if (server->ops->set_file_size_by_path) + rc = server->ops->set_file_size_by_path(xid, tcon, full_path, + attrs->ia_size, cifs_sb, + false); else rc = -ENOSYS; cifs_dbg(FYI, "SetEOF by path (setattrs) rc = %d\n", rc); diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 14d4832..c5d9ec6 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -756,7 +756,7 @@ cifs_sync_write(const unsigned int xid, struct cifsFileInfo *cfile, } static int -smb_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, +smb_set_file_size_by_path(const unsigned int xid, struct cifs_tcon *tcon, const char *full_path, __u64 size, struct cifs_sb_info *cifs_sb, bool set_allocation) { @@ -1013,8 +1013,8 @@ struct smb_version_operations smb1_operations = { .query_path_info = cifs_query_path_info, .query_file_info = cifs_query_file_info, .get_srv_inum = cifs_get_srv_inum, - .set_path_size = smb_set_file_size, - .set_file_size = CIFSSMBSetFileSize, + .set_file_size_by_path = smb_set_file_size_by_path, + .set_file_size_by_handle = CIFSSMBSetFileSize, .set_file_info = smb_set_file_info, .set_compression = cifs_set_compression, .echo = CIFSSMBEcho, diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 84c012a..78b590f 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c @@ -244,7 +244,7 @@ smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, } int -smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon, +smb2_set_file_size_by_path(const unsigned int xid, struct cifs_tcon *tcon, const char *full_path, __u64 size, struct cifs_sb_info *cifs_sb, bool set_alloc) { diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 757da3e..dc7b1cb 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/ci
[PATCH 3/4 linux-next V3] cifs: Introduce cifs_legacy_set_file_size()
Consolidates some duplicate code. Cc: Steve French Cc: Jeff Layton Cc: Dean Gehnert Signed-off-by: Tim Gardner --- V3 - no change V2 - this is a new patch in the V2 series. fs/cifs/inode.c | 54 +- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 7181516..3f710c6 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,6 +1899,30 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } +/* + * Legacy hack to set file length. + */ +static int +cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, + unsigned int length, struct cifs_tcon *tcon, + char *full_path) +{ + int rc; + unsigned int bytes_written; + struct cifs_io_parms io_parms; + + io_parms.netfid = netfid; + io_parms.pid = pid; + io_parms.tcon = tcon; + io_parms.offset = 0; + io_parms.length = length; + rc = CIFSSMBWrite(xid, _parms, _written, + NULL, NULL, 1); + cifs_dbg(FYI, "%s len %d rc %d on %s\n", __func__, length, rc, +full_path); + return rc; +} + static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) @@ -1910,7 +1934,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - struct cifs_io_parms io_parms; /* * To avoid spurious oplock breaks from server, in the case of @@ -1935,16 +1958,11 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifsFileInfo_put(open_file); cifs_dbg(FYI, "SetFSize for attrs rc = %d\n", rc); if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { - unsigned int bytes_written; - - io_parms.netfid = open_file->fid.netfid; - io_parms.pid = open_file->pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = attrs->ia_size; - rc = CIFSSMBWrite(xid, _parms, _written, - NULL, NULL, 1); - cifs_dbg(FYI, "Wrt seteof rc %d\n", rc); + rc = cifs_legacy_set_file_size(xid, + open_file->fid.netfid, + open_file->pid, + attrs->ia_size, + tcon, full_path); } } else rc = -EINVAL; @@ -1982,16 +2000,10 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); if (rc == 0) { - unsigned int bytes_written; - - io_parms.netfid = netfid; - io_parms.pid = current->tgid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = attrs->ia_size; - rc = CIFSSMBWrite(xid, _parms, _written, NULL, - NULL, 1); - cifs_dbg(FYI, "wrt seteof rc %d\n", rc); + rc = cifs_legacy_set_file_size(xid, netfid, + current->tgid, + attrs->ia_size, tcon, + full_path); CIFSSMBClose(xid, tcon, netfid); } } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4 linux-next V3] cifs: Replace CIFSSMBSetEOF() with smb_set_file_size()
0x27, smb_buf_length: 0x23 [179777.461280] fs/cifs/transport.c:cifs_sync_mid_result:571: cifs_sync_mid_result: cmd=4 mid=22 state=4 We encountered this problem whilst backporting the CIFS driver to a kernel and VFS old enough to still call inode_operations.setattr() when truncating a file. We're not sure it is the right upstream solution, but it worked for us on this older kernel. Cc: Steve French Cc: Jeff Layton Signed-off-by: Dean Gehnert Signed-off-by: Tim Gardner --- V3 - same as V2 V2 - There really is no substantive change from V1. Rather, this patch is now the first in a series that acheives the review comments set out by Jeff Layton for the V1 patch. fs/cifs/cifsproto.h |3 -- fs/cifs/cifssmb.c | 98 --- fs/cifs/smb1ops.c | 36 ++- 3 files changed, 35 insertions(+), 102 deletions(-) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index aa33976..fe69b9c 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -296,9 +296,6 @@ extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon, char *fileName, __u16 dos_attributes, const struct nls_table *nls_codepage); #endif /* possibly unneeded function */ -extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, -const char *file_name, __u64 size, -struct cifs_sb_info *cifs_sb, bool set_allocation); extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, struct cifsFileInfo *cfile, __u64 size, bool set_allocation); diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 124aa02..53f1b9b 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -5453,104 +5453,6 @@ QFSPosixRetry: return rc; } - -/* - * We can not use write of zero bytes trick to set file size due to need for - * large file support. Also note that this SetPathInfo is preferred to - * SetFileInfo based method in next routine which is only needed to work around - * a sharing violation bugin Samba which this routine can run into. - */ -int -CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, - const char *file_name, __u64 size, struct cifs_sb_info *cifs_sb, - bool set_allocation) -{ - struct smb_com_transaction2_spi_req *pSMB = NULL; - struct smb_com_transaction2_spi_rsp *pSMBr = NULL; - struct file_end_of_file_info *parm_data; - int name_len; - int rc = 0; - int bytes_returned = 0; - int remap = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR; - - __u16 params, byte_count, data_count, param_offset, offset; - - cifs_dbg(FYI, "In SetEOF\n"); -SetEOFRetry: - rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) , - (void **) ); - if (rc) - return rc; - - if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { - name_len = - cifsConvertToUTF16((__le16 *) pSMB->FileName, file_name, - PATH_MAX, cifs_sb->local_nls, remap); - name_len++; /* trailing null */ - name_len *= 2; - } else {/* BB improve the check for buffer overruns BB */ - name_len = strnlen(file_name, PATH_MAX); - name_len++; /* trailing null */ - strncpy(pSMB->FileName, file_name, name_len); - } - params = 6 + name_len; - data_count = sizeof(struct file_end_of_file_info); - pSMB->MaxParameterCount = cpu_to_le16(2); - pSMB->MaxDataCount = cpu_to_le16(4100); - pSMB->MaxSetupCount = 0; - pSMB->Reserved = 0; - pSMB->Flags = 0; - pSMB->Timeout = 0; - pSMB->Reserved2 = 0; - param_offset = offsetof(struct smb_com_transaction2_spi_req, - InformationLevel) - 4; - offset = param_offset + params; - if (set_allocation) { - if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); - else - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO); - } else /* Set File Size */ { - if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO2); - else - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); - } - - parm_data = - (struct file_end_of_file_info *) (((char *) >hdr.Protocol) + - offs
[PATCH 4/4 linux-next V3] cifs: Combine set_file_size by handle and path into one function
As suggested by Jeff Layton: "Now that I look though, it's clear to me that cifs_set_file_size is just wrong. Currently it calls ops->set_path_size and if that fails with certain error codes it tries to do a SMBLegacyOpen, etc. That's going to fall on its face if this is a SMB2/3 connection. Here's what should be done instead, I think: - get rid of both set_path_size and set_file_size operations. The version specific abstraction was implemented at the wrong level, IMO. - implement a new protocol level operation that basically takes the same args as cifs_set_file_size. cifs_setattr_unix/_nounix should call this operation. - the set_path_size operation for SMB1 should basically be the function that is cifs_set_file_size today (though that should probably be renamed). That function should be restructured to do the following: + look for an open filehandle + if there isn't one, open the file + call CIFSSMBSetFileSize + fall back to zero-length write if that fails + close the file if we opened it" This patch also moves all of the SMBv1 legacy hacks from cifs_set_file_size() into the SMBv1 specific handler smb_set_file_size() more or less intact. SMBv2 and higher are more regular and orthogonal, so the v2 handler smb2_set_file_size() no longer contains the legacy hacks. Move cifsFileInfo_put(open_file) below the first call to cifs_legacy_set_file_size() so that the reference on open_file stays valid throughout. Cc: Steve French Cc: Jeff Layton Cc: Dean Gehnert Signed-off-by: Tim Gardner --- V3 - dropped 'cifs: fix incorrect reference count check' which impacted this patch. Also moved cifsFileInfo_put(open_file) according to V2 review comments from Jeff Layton. V2 - this is a new patch in the V2 series. I know this is kind of a giant patch, but there really doesn't seem to be any intermediate steps. Its pretty much all or nothing. I've only tested against a Linux CIFS server running a 3.2 kernel since I no longer have easy access to smbv2 servers (iOS 10.8 or Windows 7). fs/cifs/cifsglob.h |9 ++--- fs/cifs/inode.c| 108 +-- fs/cifs/smb1ops.c | 109 +++- fs/cifs/smb2ops.c | 57 --- 4 files changed, 170 insertions(+), 113 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8fd8eb2..6113ce8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -269,12 +269,9 @@ struct smb_version_operations { int (*get_srv_inum)(const unsigned int, struct cifs_tcon *, struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); - /* set size by path */ - int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, -const char *, __u64, struct cifs_sb_info *, bool); - /* set size by file handle */ - int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, -struct cifsFileInfo *, __u64, bool); + /* set file size */ + int (*set_file_size)(struct inode *inode, struct iattr *attrs, +unsigned int xid, char *full_path); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, const unsigned int); diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 3f710c6..3edeafd 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,118 +1899,28 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } -/* - * Legacy hack to set file length. - */ -static int -cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, - unsigned int length, struct cifs_tcon *tcon, - char *full_path) -{ - int rc; - unsigned int bytes_written; - struct cifs_io_parms io_parms; - - io_parms.netfid = netfid; - io_parms.pid = pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = length; - rc = CIFSSMBWrite(xid, _parms, _written, - NULL, NULL, 1); - cifs_dbg(FYI, "%s len %d rc %d on %s\n", __func__, length, rc, -full_path); - return rc; -} - static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) { - int rc; - struct cifsFileInfo *open_file; + int rc = -ENOSYS; struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - /* -* To avoid spurious oplock breaks from server, in the case of -* inodes that we already have op
Re: [PATCH 4/5 linux-next V2] cifs: fix incorrect reference count check
On 12/09/2013 04:03 AM, Jeff Layton wrote: > On Sun, 8 Dec 2013 14:08:43 -0700 > Tim Gardner wrote: > >> The reference count on tlink can only be decremented if >> cifs_sb_tlink(cifs_sb) was used to acquire it. That only >> happens if open_file==NULL. >> >> Cc: Steve French >> Cc: Jeff Layton >> Cc: Dean Gehnert >> Signed-off-by: Tim Gardner >> --- >> >> V2 - this is a new patch in the V2 series. >> >> fs/cifs/inode.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c >> index 3f710c6..e332038 100644 >> --- a/fs/cifs/inode.c >> +++ b/fs/cifs/inode.c >> @@ -2007,7 +2007,7 @@ cifs_set_file_size(struct inode *inode, struct iattr >> *attrs, >> CIFSSMBClose(xid, tcon, netfid); >> } >> } >> -if (tlink) >> +if (!open_file) >> cifs_put_tlink(tlink); >> >> set_size_out: > > > I don't see the bug here... > > The only place tlink gets set to a non-NULL value is where > cifs_sb_tlink gets called. Am I missing something? > Nope - I think you're correct. For some reason I thought tlink was set inside the 'if (openfile) {...}' clause. I'll drop this patch from the V3 series. rtg -- Tim Gardner t...@tpi.com www.tpi.com OR 503-601-0234 x102 MT 406-443-5357 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5 linux-next V2] cifs: fix incorrect reference count check
On 12/09/2013 04:03 AM, Jeff Layton wrote: On Sun, 8 Dec 2013 14:08:43 -0700 Tim Gardner t...@tpi.com wrote: The reference count on tlink can only be decremented if cifs_sb_tlink(cifs_sb) was used to acquire it. That only happens if open_file==NULL. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Cc: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V2 - this is a new patch in the V2 series. fs/cifs/inode.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 3f710c6..e332038 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -2007,7 +2007,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, CIFSSMBClose(xid, tcon, netfid); } } -if (tlink) +if (!open_file) cifs_put_tlink(tlink); set_size_out: I don't see the bug here... The only place tlink gets set to a non-NULL value is where cifs_sb_tlink gets called. Am I missing something? Nope - I think you're correct. For some reason I thought tlink was set inside the 'if (openfile) {...}' clause. I'll drop this patch from the V3 series. rtg -- Tim Gardner t...@tpi.com www.tpi.com OR 503-601-0234 x102 MT 406-443-5357 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4 linux-next V3] cifs: Replace CIFSSMBSetEOF() with smb_set_file_size()
/transport.c:cifs_sync_mid_result:571: cifs_sync_mid_result: cmd=4 mid=22 state=4 We encountered this problem whilst backporting the CIFS driver to a kernel and VFS old enough to still call inode_operations.setattr() when truncating a file. We're not sure it is the right upstream solution, but it worked for us on this older kernel. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Signed-off-by: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V3 - same as V2 V2 - There really is no substantive change from V1. Rather, this patch is now the first in a series that acheives the review comments set out by Jeff Layton for the V1 patch. fs/cifs/cifsproto.h |3 -- fs/cifs/cifssmb.c | 98 --- fs/cifs/smb1ops.c | 36 ++- 3 files changed, 35 insertions(+), 102 deletions(-) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index aa33976..fe69b9c 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -296,9 +296,6 @@ extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon, char *fileName, __u16 dos_attributes, const struct nls_table *nls_codepage); #endif /* possibly unneeded function */ -extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, -const char *file_name, __u64 size, -struct cifs_sb_info *cifs_sb, bool set_allocation); extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, struct cifsFileInfo *cfile, __u64 size, bool set_allocation); diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 124aa02..53f1b9b 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -5453,104 +5453,6 @@ QFSPosixRetry: return rc; } - -/* - * We can not use write of zero bytes trick to set file size due to need for - * large file support. Also note that this SetPathInfo is preferred to - * SetFileInfo based method in next routine which is only needed to work around - * a sharing violation bugin Samba which this routine can run into. - */ -int -CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, - const char *file_name, __u64 size, struct cifs_sb_info *cifs_sb, - bool set_allocation) -{ - struct smb_com_transaction2_spi_req *pSMB = NULL; - struct smb_com_transaction2_spi_rsp *pSMBr = NULL; - struct file_end_of_file_info *parm_data; - int name_len; - int rc = 0; - int bytes_returned = 0; - int remap = cifs_sb-mnt_cifs_flags CIFS_MOUNT_MAP_SPECIAL_CHR; - - __u16 params, byte_count, data_count, param_offset, offset; - - cifs_dbg(FYI, In SetEOF\n); -SetEOFRetry: - rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) pSMB, - (void **) pSMBr); - if (rc) - return rc; - - if (pSMB-hdr.Flags2 SMBFLG2_UNICODE) { - name_len = - cifsConvertToUTF16((__le16 *) pSMB-FileName, file_name, - PATH_MAX, cifs_sb-local_nls, remap); - name_len++; /* trailing null */ - name_len *= 2; - } else {/* BB improve the check for buffer overruns BB */ - name_len = strnlen(file_name, PATH_MAX); - name_len++; /* trailing null */ - strncpy(pSMB-FileName, file_name, name_len); - } - params = 6 + name_len; - data_count = sizeof(struct file_end_of_file_info); - pSMB-MaxParameterCount = cpu_to_le16(2); - pSMB-MaxDataCount = cpu_to_le16(4100); - pSMB-MaxSetupCount = 0; - pSMB-Reserved = 0; - pSMB-Flags = 0; - pSMB-Timeout = 0; - pSMB-Reserved2 = 0; - param_offset = offsetof(struct smb_com_transaction2_spi_req, - InformationLevel) - 4; - offset = param_offset + params; - if (set_allocation) { - if (tcon-ses-capabilities CAP_INFOLEVEL_PASSTHRU) - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); - else - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO); - } else /* Set File Size */ { - if (tcon-ses-capabilities CAP_INFOLEVEL_PASSTHRU) - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO2); - else - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); - } - - parm_data = - (struct file_end_of_file_info *) (((char *) pSMB-hdr.Protocol) + - offset); - pSMB-ParameterOffset = cpu_to_le16(param_offset); - pSMB-DataOffset
[PATCH 3/4 linux-next V3] cifs: Introduce cifs_legacy_set_file_size()
Consolidates some duplicate code. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Cc: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V3 - no change V2 - this is a new patch in the V2 series. fs/cifs/inode.c | 54 +- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 7181516..3f710c6 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,6 +1899,30 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } +/* + * Legacy hack to set file length. + */ +static int +cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, + unsigned int length, struct cifs_tcon *tcon, + char *full_path) +{ + int rc; + unsigned int bytes_written; + struct cifs_io_parms io_parms; + + io_parms.netfid = netfid; + io_parms.pid = pid; + io_parms.tcon = tcon; + io_parms.offset = 0; + io_parms.length = length; + rc = CIFSSMBWrite(xid, io_parms, bytes_written, + NULL, NULL, 1); + cifs_dbg(FYI, %s len %d rc %d on %s\n, __func__, length, rc, +full_path); + return rc; +} + static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) @@ -1910,7 +1934,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - struct cifs_io_parms io_parms; /* * To avoid spurious oplock breaks from server, in the case of @@ -1935,16 +1958,11 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifsFileInfo_put(open_file); cifs_dbg(FYI, SetFSize for attrs rc = %d\n, rc); if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { - unsigned int bytes_written; - - io_parms.netfid = open_file-fid.netfid; - io_parms.pid = open_file-pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = attrs-ia_size; - rc = CIFSSMBWrite(xid, io_parms, bytes_written, - NULL, NULL, 1); - cifs_dbg(FYI, Wrt seteof rc %d\n, rc); + rc = cifs_legacy_set_file_size(xid, + open_file-fid.netfid, + open_file-pid, + attrs-ia_size, + tcon, full_path); } } else rc = -EINVAL; @@ -1982,16 +2000,10 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifs_sb-mnt_cifs_flags CIFS_MOUNT_MAP_SPECIAL_CHR); if (rc == 0) { - unsigned int bytes_written; - - io_parms.netfid = netfid; - io_parms.pid = current-tgid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = attrs-ia_size; - rc = CIFSSMBWrite(xid, io_parms, bytes_written, NULL, - NULL, 1); - cifs_dbg(FYI, wrt seteof rc %d\n, rc); + rc = cifs_legacy_set_file_size(xid, netfid, + current-tgid, + attrs-ia_size, tcon, + full_path); CIFSSMBClose(xid, tcon, netfid); } } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4 linux-next V3] cifs: Combine set_file_size by handle and path into one function
As suggested by Jeff Layton: Now that I look though, it's clear to me that cifs_set_file_size is just wrong. Currently it calls ops-set_path_size and if that fails with certain error codes it tries to do a SMBLegacyOpen, etc. That's going to fall on its face if this is a SMB2/3 connection. Here's what should be done instead, I think: - get rid of both set_path_size and set_file_size operations. The version specific abstraction was implemented at the wrong level, IMO. - implement a new protocol level operation that basically takes the same args as cifs_set_file_size. cifs_setattr_unix/_nounix should call this operation. - the set_path_size operation for SMB1 should basically be the function that is cifs_set_file_size today (though that should probably be renamed). That function should be restructured to do the following: + look for an open filehandle + if there isn't one, open the file + call CIFSSMBSetFileSize + fall back to zero-length write if that fails + close the file if we opened it This patch also moves all of the SMBv1 legacy hacks from cifs_set_file_size() into the SMBv1 specific handler smb_set_file_size() more or less intact. SMBv2 and higher are more regular and orthogonal, so the v2 handler smb2_set_file_size() no longer contains the legacy hacks. Move cifsFileInfo_put(open_file) below the first call to cifs_legacy_set_file_size() so that the reference on open_file stays valid throughout. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Cc: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V3 - dropped 'cifs: fix incorrect reference count check' which impacted this patch. Also moved cifsFileInfo_put(open_file) according to V2 review comments from Jeff Layton. V2 - this is a new patch in the V2 series. I know this is kind of a giant patch, but there really doesn't seem to be any intermediate steps. Its pretty much all or nothing. I've only tested against a Linux CIFS server running a 3.2 kernel since I no longer have easy access to smbv2 servers (iOS 10.8 or Windows 7). fs/cifs/cifsglob.h |9 ++--- fs/cifs/inode.c| 108 +-- fs/cifs/smb1ops.c | 109 +++- fs/cifs/smb2ops.c | 57 --- 4 files changed, 170 insertions(+), 113 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8fd8eb2..6113ce8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -269,12 +269,9 @@ struct smb_version_operations { int (*get_srv_inum)(const unsigned int, struct cifs_tcon *, struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); - /* set size by path */ - int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, -const char *, __u64, struct cifs_sb_info *, bool); - /* set size by file handle */ - int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, -struct cifsFileInfo *, __u64, bool); + /* set file size */ + int (*set_file_size)(struct inode *inode, struct iattr *attrs, +unsigned int xid, char *full_path); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, const unsigned int); diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 3f710c6..3edeafd 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,118 +1899,28 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } -/* - * Legacy hack to set file length. - */ -static int -cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, - unsigned int length, struct cifs_tcon *tcon, - char *full_path) -{ - int rc; - unsigned int bytes_written; - struct cifs_io_parms io_parms; - - io_parms.netfid = netfid; - io_parms.pid = pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = length; - rc = CIFSSMBWrite(xid, io_parms, bytes_written, - NULL, NULL, 1); - cifs_dbg(FYI, %s len %d rc %d on %s\n, __func__, length, rc, -full_path); - return rc; -} - static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) { - int rc; - struct cifsFileInfo *open_file; + int rc = -ENOSYS; struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifs_sb_info *cifs_sb = CIFS_SB(inode-i_sb); struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - /* -* To avoid spurious oplock breaks from server, in the case
[PATCH 2/4 linux-next V3] cifs: rename set_path_size and set_file_size
These 2 method names are a bit confusing. Rename them so that one can tell at a glance how they are to be used. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Cc: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V3 - no change V2 - this is a new patch in the V2 series. fs/cifs/cifsglob.h |4 ++-- fs/cifs/inode.c | 15 +-- fs/cifs/smb1ops.c |6 +++--- fs/cifs/smb2inode.c |2 +- fs/cifs/smb2ops.c | 14 +++--- fs/cifs/smb2proto.h |8 +--- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f918a99..8fd8eb2 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -270,10 +270,10 @@ struct smb_version_operations { struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); /* set size by path */ - int (*set_path_size)(const unsigned int, struct cifs_tcon *, + int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, const char *, __u64, struct cifs_sb_info *, bool); /* set size by file handle */ - int (*set_file_size)(const unsigned int, struct cifs_tcon *, + int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, struct cifsFileInfo *, __u64, bool); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 36f9ebb..7181516 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1925,9 +1925,11 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, if (open_file) { tcon = tlink_tcon(open_file-tlink); server = tcon-ses-server; - if (server-ops-set_file_size) - rc = server-ops-set_file_size(xid, tcon, open_file, - attrs-ia_size, false); + if (server-ops-set_file_size_by_handle) + rc = server-ops-set_file_size_by_handle(xid, tcon, + open_file, + attrs-ia_size, + false); else rc = -ENOSYS; cifsFileInfo_put(open_file); @@ -1963,9 +1965,10 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, * valid, writeable file handle for it was found or because there was * an error setting it by handle. */ - if (server-ops-set_path_size) - rc = server-ops-set_path_size(xid, tcon, full_path, - attrs-ia_size, cifs_sb, false); + if (server-ops-set_file_size_by_path) + rc = server-ops-set_file_size_by_path(xid, tcon, full_path, + attrs-ia_size, cifs_sb, + false); else rc = -ENOSYS; cifs_dbg(FYI, SetEOF by path (setattrs) rc = %d\n, rc); diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 14d4832..c5d9ec6 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -756,7 +756,7 @@ cifs_sync_write(const unsigned int xid, struct cifsFileInfo *cfile, } static int -smb_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, +smb_set_file_size_by_path(const unsigned int xid, struct cifs_tcon *tcon, const char *full_path, __u64 size, struct cifs_sb_info *cifs_sb, bool set_allocation) { @@ -1013,8 +1013,8 @@ struct smb_version_operations smb1_operations = { .query_path_info = cifs_query_path_info, .query_file_info = cifs_query_file_info, .get_srv_inum = cifs_get_srv_inum, - .set_path_size = smb_set_file_size, - .set_file_size = CIFSSMBSetFileSize, + .set_file_size_by_path = smb_set_file_size_by_path, + .set_file_size_by_handle = CIFSSMBSetFileSize, .set_file_info = smb_set_file_info, .set_compression = cifs_set_compression, .echo = CIFSSMBEcho, diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 84c012a..78b590f 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c @@ -244,7 +244,7 @@ smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, } int -smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon, +smb2_set_file_size_by_path(const unsigned int xid, struct cifs_tcon *tcon, const char *full_path, __u64 size, struct cifs_sb_info *cifs_sb, bool set_alloc) { diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 757da3e..dc7b1cb 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -688,7 +688,7 @@ smb2_sync_write
[PATCH 5/5 linux-next V2 (resend)] cifs: Combine set_file_size by handle and path into one function
As suggested by Jeff Layton: "Now that I look though, it's clear to me that cifs_set_file_size is just wrong. Currently it calls ops->set_path_size and if that fails with certain error codes it tries to do a SMBLegacyOpen, etc. That's going to fall on its face if this is a SMB2/3 connection. Here's what should be done instead, I think: - get rid of both set_path_size and set_file_size operations. The version specific abstraction was implemented at the wrong level, IMO. - implement a new protocol level operation that basically takes the same args as cifs_set_file_size. cifs_setattr_unix/_nounix should call this operation. - the set_path_size operation for SMB1 should basically be the function that is cifs_set_file_size today (though that should probably be renamed). That function should be restructured to do the following: + look for an open filehandle + if there isn't one, open the file + call CIFSSMBSetFileSize + fall back to zero-length write if that fails + close the file if we opened it" This patch also moves all of the SMBv1 legacy hacks from cifs_set_file_size() into the SMBv1 specific handler smb_set_file_size() more or less intact. SMBv2 and higher are more regular and orthogonal, so the v2 handler smb2_set_file_size() no longer contains the legacy hacks. Cc: Steve French Cc: Jeff Layton Cc: Dean Gehnert Signed-off-by: Tim Gardner --- V2 - this is a new patch in the V2 series. I know this is kind of a giant patch, but there really doesn't seem to be any intermediate steps. Its pretty much all or nothing. I've only tested against a Linux CIFS server running a 3.2 kernel since I no longer have easy access to smbv2 servers (iOS 10.8 or Windows 7). resent with corrected Cc's rtg fs/cifs/cifsglob.h |9 ++--- fs/cifs/inode.c| 108 +-- fs/cifs/smb1ops.c | 109 +++- fs/cifs/smb2ops.c | 57 --- 4 files changed, 170 insertions(+), 113 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8fd8eb2..6113ce8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -269,12 +269,9 @@ struct smb_version_operations { int (*get_srv_inum)(const unsigned int, struct cifs_tcon *, struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); - /* set size by path */ - int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, -const char *, __u64, struct cifs_sb_info *, bool); - /* set size by file handle */ - int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, -struct cifsFileInfo *, __u64, bool); + /* set file size */ + int (*set_file_size)(struct inode *inode, struct iattr *attrs, +unsigned int xid, char *full_path); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, const unsigned int); diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index e332038..3edeafd 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,118 +1899,28 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } -/* - * Legacy hack to set file length. - */ -static int -cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, - unsigned int length, struct cifs_tcon *tcon, - char *full_path) -{ - int rc; - unsigned int bytes_written; - struct cifs_io_parms io_parms; - - io_parms.netfid = netfid; - io_parms.pid = pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = length; - rc = CIFSSMBWrite(xid, _parms, _written, - NULL, NULL, 1); - cifs_dbg(FYI, "%s len %d rc %d on %s\n", __func__, length, rc, -full_path); - return rc; -} - static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) { - int rc; - struct cifsFileInfo *open_file; + int rc = -ENOSYS; struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - /* -* To avoid spurious oplock breaks from server, in the case of -* inodes that we already have open, avoid doing path based -* setting of file size if we can do it by handle. -* This keeps our caching token (oplock) and avoids timeouts -* when the local oplock break takes longer to flush -* writebehind data than the SMB timeout for the SetPathInf
[PATCH 3/5 linux-next V2] cifs: Introduce cifs_legacy_set_file_size()
Consolidates some duplicate code. Cc: Steve French Cc: Jeff Layton Cc: Dean Gehnert Signed-off-by: Tim Gardner --- V2 - this is a new patch in the V2 series. fs/cifs/inode.c | 54 +- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 7181516..3f710c6 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,6 +1899,30 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } +/* + * Legacy hack to set file length. + */ +static int +cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, + unsigned int length, struct cifs_tcon *tcon, + char *full_path) +{ + int rc; + unsigned int bytes_written; + struct cifs_io_parms io_parms; + + io_parms.netfid = netfid; + io_parms.pid = pid; + io_parms.tcon = tcon; + io_parms.offset = 0; + io_parms.length = length; + rc = CIFSSMBWrite(xid, _parms, _written, + NULL, NULL, 1); + cifs_dbg(FYI, "%s len %d rc %d on %s\n", __func__, length, rc, +full_path); + return rc; +} + static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) @@ -1910,7 +1934,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - struct cifs_io_parms io_parms; /* * To avoid spurious oplock breaks from server, in the case of @@ -1935,16 +1958,11 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifsFileInfo_put(open_file); cifs_dbg(FYI, "SetFSize for attrs rc = %d\n", rc); if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { - unsigned int bytes_written; - - io_parms.netfid = open_file->fid.netfid; - io_parms.pid = open_file->pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = attrs->ia_size; - rc = CIFSSMBWrite(xid, _parms, _written, - NULL, NULL, 1); - cifs_dbg(FYI, "Wrt seteof rc %d\n", rc); + rc = cifs_legacy_set_file_size(xid, + open_file->fid.netfid, + open_file->pid, + attrs->ia_size, + tcon, full_path); } } else rc = -EINVAL; @@ -1982,16 +2000,10 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); if (rc == 0) { - unsigned int bytes_written; - - io_parms.netfid = netfid; - io_parms.pid = current->tgid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = attrs->ia_size; - rc = CIFSSMBWrite(xid, _parms, _written, NULL, - NULL, 1); - cifs_dbg(FYI, "wrt seteof rc %d\n", rc); + rc = cifs_legacy_set_file_size(xid, netfid, + current->tgid, + attrs->ia_size, tcon, + full_path); CIFSSMBClose(xid, tcon, netfid); } } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5 linux-next V2] cifs: Combine set_file_size by handle and path into one function
As suggested by Jeff Layton: "Now that I look though, it's clear to me that cifs_set_file_size is just wrong. Currently it calls ops->set_path_size and if that fails with certain error codes it tries to do a SMBLegacyOpen, etc. That's going to fall on its face if this is a SMB2/3 connection. Here's what should be done instead, I think: - get rid of both set_path_size and set_file_size operations. The version specific abstraction was implemented at the wrong level, IMO. - implement a new protocol level operation that basically takes the same args as cifs_set_file_size. cifs_setattr_unix/_nounix should call this operation. - the set_path_size operation for SMB1 should basically be the function that is cifs_set_file_size today (though that should probably be renamed). That function should be restructured to do the following: + look for an open filehandle + if there isn't one, open the file + call CIFSSMBSetFileSize + fall back to zero-length write if that fails + close the file if we opened it" This patch also moves all of the SMBv1 legacy hacks from cifs_set_file_size() into the SMBv1 specific handler smb_set_file_size() more or less intact. SMBv2 and higher are more regular and orthogonal, so the v2 handler smb2_set_file_size() no longer contains the legacy hacks. Signed-off-by: Tim Gardner --- V2 - this is a new patch in the V2 series. I know this is kind of a giant patch, but there really doesn't seem to be any intermediate steps. Its pretty much all or nothing. I've only tested against a Linux CIFS server running a 3.2 kernel since I no longer have easy access to smbv2 servers (iOS 10.8 or Windows 7). rtg fs/cifs/cifsglob.h |9 ++--- fs/cifs/inode.c| 108 +-- fs/cifs/smb1ops.c | 109 +++- fs/cifs/smb2ops.c | 57 --- 4 files changed, 170 insertions(+), 113 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8fd8eb2..6113ce8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -269,12 +269,9 @@ struct smb_version_operations { int (*get_srv_inum)(const unsigned int, struct cifs_tcon *, struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); - /* set size by path */ - int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, -const char *, __u64, struct cifs_sb_info *, bool); - /* set size by file handle */ - int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, -struct cifsFileInfo *, __u64, bool); + /* set file size */ + int (*set_file_size)(struct inode *inode, struct iattr *attrs, +unsigned int xid, char *full_path); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, const unsigned int); diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index e332038..3edeafd 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,118 +1899,28 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } -/* - * Legacy hack to set file length. - */ -static int -cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, - unsigned int length, struct cifs_tcon *tcon, - char *full_path) -{ - int rc; - unsigned int bytes_written; - struct cifs_io_parms io_parms; - - io_parms.netfid = netfid; - io_parms.pid = pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = length; - rc = CIFSSMBWrite(xid, _parms, _written, - NULL, NULL, 1); - cifs_dbg(FYI, "%s len %d rc %d on %s\n", __func__, length, rc, -full_path); - return rc; -} - static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) { - int rc; - struct cifsFileInfo *open_file; + int rc = -ENOSYS; struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - /* -* To avoid spurious oplock breaks from server, in the case of -* inodes that we already have open, avoid doing path based -* setting of file size if we can do it by handle. -* This keeps our caching token (oplock) and avoids timeouts -* when the local oplock break takes longer to flush -* writebehind data than the SMB timeout for the SetPathInfo -* request would allow -*/ - open_file = find_wri
[PATCH 4/5 linux-next V2] cifs: fix incorrect reference count check
The reference count on tlink can only be decremented if cifs_sb_tlink(cifs_sb) was used to acquire it. That only happens if open_file==NULL. Cc: Steve French Cc: Jeff Layton Cc: Dean Gehnert Signed-off-by: Tim Gardner --- V2 - this is a new patch in the V2 series. fs/cifs/inode.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 3f710c6..e332038 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -2007,7 +2007,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, CIFSSMBClose(xid, tcon, netfid); } } - if (tlink) + if (!open_file) cifs_put_tlink(tlink); set_size_out: -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5 linux-next V2] cifs: Replace CIFSSMBSetEOF() with smb_set_file_size()
0x27, smb_buf_length: 0x23 [179777.461280] fs/cifs/transport.c:cifs_sync_mid_result:571: cifs_sync_mid_result: cmd=4 mid=22 state=4 We encountered this problem whilst backporting the CIFS driver to a kernel and VFS old enough to still call inode_operations.setattr() when truncating a file. We're not sure it is the right upstream solution, but it worked for us on this older kernel. Cc: Steve French Cc: Jeff Layton Signed-off-by: Dean Gehnert Signed-off-by: Tim Gardner --- V2 - There really is no substantive change from V1. Rather, this patch is now the first in a series that acheives the review comments set out by Jeff Layton for the V1 patch. fs/cifs/cifsproto.h |3 -- fs/cifs/cifssmb.c | 98 --- fs/cifs/smb1ops.c | 36 ++- 3 files changed, 35 insertions(+), 102 deletions(-) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index aa33976..fe69b9c 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -296,9 +296,6 @@ extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon, char *fileName, __u16 dos_attributes, const struct nls_table *nls_codepage); #endif /* possibly unneeded function */ -extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, -const char *file_name, __u64 size, -struct cifs_sb_info *cifs_sb, bool set_allocation); extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, struct cifsFileInfo *cfile, __u64 size, bool set_allocation); diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 124aa02..53f1b9b 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -5453,104 +5453,6 @@ QFSPosixRetry: return rc; } - -/* - * We can not use write of zero bytes trick to set file size due to need for - * large file support. Also note that this SetPathInfo is preferred to - * SetFileInfo based method in next routine which is only needed to work around - * a sharing violation bugin Samba which this routine can run into. - */ -int -CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, - const char *file_name, __u64 size, struct cifs_sb_info *cifs_sb, - bool set_allocation) -{ - struct smb_com_transaction2_spi_req *pSMB = NULL; - struct smb_com_transaction2_spi_rsp *pSMBr = NULL; - struct file_end_of_file_info *parm_data; - int name_len; - int rc = 0; - int bytes_returned = 0; - int remap = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR; - - __u16 params, byte_count, data_count, param_offset, offset; - - cifs_dbg(FYI, "In SetEOF\n"); -SetEOFRetry: - rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) , - (void **) ); - if (rc) - return rc; - - if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { - name_len = - cifsConvertToUTF16((__le16 *) pSMB->FileName, file_name, - PATH_MAX, cifs_sb->local_nls, remap); - name_len++; /* trailing null */ - name_len *= 2; - } else {/* BB improve the check for buffer overruns BB */ - name_len = strnlen(file_name, PATH_MAX); - name_len++; /* trailing null */ - strncpy(pSMB->FileName, file_name, name_len); - } - params = 6 + name_len; - data_count = sizeof(struct file_end_of_file_info); - pSMB->MaxParameterCount = cpu_to_le16(2); - pSMB->MaxDataCount = cpu_to_le16(4100); - pSMB->MaxSetupCount = 0; - pSMB->Reserved = 0; - pSMB->Flags = 0; - pSMB->Timeout = 0; - pSMB->Reserved2 = 0; - param_offset = offsetof(struct smb_com_transaction2_spi_req, - InformationLevel) - 4; - offset = param_offset + params; - if (set_allocation) { - if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); - else - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO); - } else /* Set File Size */ { - if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO2); - else - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); - } - - parm_data = - (struct file_end_of_file_info *) (((char *) >hdr.Protocol) + - offset); - p
[PATCH 2/5 linux-next V2] cifs: rename set_path_size and set_file_size
These 2 method names are a bit confusing. Rename them so that one can tell at a glance how they are to be used. Cc: Steve French Cc: Jeff Layton Cc: Dean Gehnert Signed-off-by: Tim Gardner --- V2 - this is a new patch in the V2 series. fs/cifs/cifsglob.h |4 ++-- fs/cifs/inode.c | 15 +-- fs/cifs/smb1ops.c |6 +++--- fs/cifs/smb2inode.c |2 +- fs/cifs/smb2ops.c | 14 +++--- fs/cifs/smb2proto.h |8 +--- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f918a99..8fd8eb2 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -270,10 +270,10 @@ struct smb_version_operations { struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); /* set size by path */ - int (*set_path_size)(const unsigned int, struct cifs_tcon *, + int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, const char *, __u64, struct cifs_sb_info *, bool); /* set size by file handle */ - int (*set_file_size)(const unsigned int, struct cifs_tcon *, + int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, struct cifsFileInfo *, __u64, bool); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 36f9ebb..7181516 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1925,9 +1925,11 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, if (open_file) { tcon = tlink_tcon(open_file->tlink); server = tcon->ses->server; - if (server->ops->set_file_size) - rc = server->ops->set_file_size(xid, tcon, open_file, - attrs->ia_size, false); + if (server->ops->set_file_size_by_handle) + rc = server->ops->set_file_size_by_handle(xid, tcon, + open_file, + attrs->ia_size, + false); else rc = -ENOSYS; cifsFileInfo_put(open_file); @@ -1963,9 +1965,10 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, * valid, writeable file handle for it was found or because there was * an error setting it by handle. */ - if (server->ops->set_path_size) - rc = server->ops->set_path_size(xid, tcon, full_path, - attrs->ia_size, cifs_sb, false); + if (server->ops->set_file_size_by_path) + rc = server->ops->set_file_size_by_path(xid, tcon, full_path, + attrs->ia_size, cifs_sb, + false); else rc = -ENOSYS; cifs_dbg(FYI, "SetEOF by path (setattrs) rc = %d\n", rc); diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 14d4832..c5d9ec6 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -756,7 +756,7 @@ cifs_sync_write(const unsigned int xid, struct cifsFileInfo *cfile, } static int -smb_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, +smb_set_file_size_by_path(const unsigned int xid, struct cifs_tcon *tcon, const char *full_path, __u64 size, struct cifs_sb_info *cifs_sb, bool set_allocation) { @@ -1013,8 +1013,8 @@ struct smb_version_operations smb1_operations = { .query_path_info = cifs_query_path_info, .query_file_info = cifs_query_file_info, .get_srv_inum = cifs_get_srv_inum, - .set_path_size = smb_set_file_size, - .set_file_size = CIFSSMBSetFileSize, + .set_file_size_by_path = smb_set_file_size_by_path, + .set_file_size_by_handle = CIFSSMBSetFileSize, .set_file_info = smb_set_file_info, .set_compression = cifs_set_compression, .echo = CIFSSMBEcho, diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 84c012a..78b590f 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c @@ -244,7 +244,7 @@ smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, } int -smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon, +smb2_set_file_size_by_path(const unsigned int xid, struct cifs_tcon *tcon, const char *full_path, __u64 size, struct cifs_sb_info *cifs_sb, bool set_alloc) { diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 757da3e..dc7b1cb 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -688,
[PATCH 1/5 linux-next V2] cifs: Replace CIFSSMBSetEOF() with smb_set_file_size()
/transport.c:cifs_sync_mid_result:571: cifs_sync_mid_result: cmd=4 mid=22 state=4 We encountered this problem whilst backporting the CIFS driver to a kernel and VFS old enough to still call inode_operations.setattr() when truncating a file. We're not sure it is the right upstream solution, but it worked for us on this older kernel. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Signed-off-by: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V2 - There really is no substantive change from V1. Rather, this patch is now the first in a series that acheives the review comments set out by Jeff Layton for the V1 patch. fs/cifs/cifsproto.h |3 -- fs/cifs/cifssmb.c | 98 --- fs/cifs/smb1ops.c | 36 ++- 3 files changed, 35 insertions(+), 102 deletions(-) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index aa33976..fe69b9c 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -296,9 +296,6 @@ extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon, char *fileName, __u16 dos_attributes, const struct nls_table *nls_codepage); #endif /* possibly unneeded function */ -extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, -const char *file_name, __u64 size, -struct cifs_sb_info *cifs_sb, bool set_allocation); extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, struct cifsFileInfo *cfile, __u64 size, bool set_allocation); diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 124aa02..53f1b9b 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -5453,104 +5453,6 @@ QFSPosixRetry: return rc; } - -/* - * We can not use write of zero bytes trick to set file size due to need for - * large file support. Also note that this SetPathInfo is preferred to - * SetFileInfo based method in next routine which is only needed to work around - * a sharing violation bugin Samba which this routine can run into. - */ -int -CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, - const char *file_name, __u64 size, struct cifs_sb_info *cifs_sb, - bool set_allocation) -{ - struct smb_com_transaction2_spi_req *pSMB = NULL; - struct smb_com_transaction2_spi_rsp *pSMBr = NULL; - struct file_end_of_file_info *parm_data; - int name_len; - int rc = 0; - int bytes_returned = 0; - int remap = cifs_sb-mnt_cifs_flags CIFS_MOUNT_MAP_SPECIAL_CHR; - - __u16 params, byte_count, data_count, param_offset, offset; - - cifs_dbg(FYI, In SetEOF\n); -SetEOFRetry: - rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) pSMB, - (void **) pSMBr); - if (rc) - return rc; - - if (pSMB-hdr.Flags2 SMBFLG2_UNICODE) { - name_len = - cifsConvertToUTF16((__le16 *) pSMB-FileName, file_name, - PATH_MAX, cifs_sb-local_nls, remap); - name_len++; /* trailing null */ - name_len *= 2; - } else {/* BB improve the check for buffer overruns BB */ - name_len = strnlen(file_name, PATH_MAX); - name_len++; /* trailing null */ - strncpy(pSMB-FileName, file_name, name_len); - } - params = 6 + name_len; - data_count = sizeof(struct file_end_of_file_info); - pSMB-MaxParameterCount = cpu_to_le16(2); - pSMB-MaxDataCount = cpu_to_le16(4100); - pSMB-MaxSetupCount = 0; - pSMB-Reserved = 0; - pSMB-Flags = 0; - pSMB-Timeout = 0; - pSMB-Reserved2 = 0; - param_offset = offsetof(struct smb_com_transaction2_spi_req, - InformationLevel) - 4; - offset = param_offset + params; - if (set_allocation) { - if (tcon-ses-capabilities CAP_INFOLEVEL_PASSTHRU) - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); - else - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO); - } else /* Set File Size */ { - if (tcon-ses-capabilities CAP_INFOLEVEL_PASSTHRU) - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO2); - else - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); - } - - parm_data = - (struct file_end_of_file_info *) (((char *) pSMB-hdr.Protocol) + - offset); - pSMB-ParameterOffset = cpu_to_le16(param_offset); - pSMB-DataOffset = cpu_to_le16(offset
[PATCH 2/5 linux-next V2] cifs: rename set_path_size and set_file_size
These 2 method names are a bit confusing. Rename them so that one can tell at a glance how they are to be used. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Cc: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V2 - this is a new patch in the V2 series. fs/cifs/cifsglob.h |4 ++-- fs/cifs/inode.c | 15 +-- fs/cifs/smb1ops.c |6 +++--- fs/cifs/smb2inode.c |2 +- fs/cifs/smb2ops.c | 14 +++--- fs/cifs/smb2proto.h |8 +--- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index f918a99..8fd8eb2 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -270,10 +270,10 @@ struct smb_version_operations { struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); /* set size by path */ - int (*set_path_size)(const unsigned int, struct cifs_tcon *, + int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, const char *, __u64, struct cifs_sb_info *, bool); /* set size by file handle */ - int (*set_file_size)(const unsigned int, struct cifs_tcon *, + int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, struct cifsFileInfo *, __u64, bool); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 36f9ebb..7181516 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1925,9 +1925,11 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, if (open_file) { tcon = tlink_tcon(open_file-tlink); server = tcon-ses-server; - if (server-ops-set_file_size) - rc = server-ops-set_file_size(xid, tcon, open_file, - attrs-ia_size, false); + if (server-ops-set_file_size_by_handle) + rc = server-ops-set_file_size_by_handle(xid, tcon, + open_file, + attrs-ia_size, + false); else rc = -ENOSYS; cifsFileInfo_put(open_file); @@ -1963,9 +1965,10 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, * valid, writeable file handle for it was found or because there was * an error setting it by handle. */ - if (server-ops-set_path_size) - rc = server-ops-set_path_size(xid, tcon, full_path, - attrs-ia_size, cifs_sb, false); + if (server-ops-set_file_size_by_path) + rc = server-ops-set_file_size_by_path(xid, tcon, full_path, + attrs-ia_size, cifs_sb, + false); else rc = -ENOSYS; cifs_dbg(FYI, SetEOF by path (setattrs) rc = %d\n, rc); diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 14d4832..c5d9ec6 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -756,7 +756,7 @@ cifs_sync_write(const unsigned int xid, struct cifsFileInfo *cfile, } static int -smb_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, +smb_set_file_size_by_path(const unsigned int xid, struct cifs_tcon *tcon, const char *full_path, __u64 size, struct cifs_sb_info *cifs_sb, bool set_allocation) { @@ -1013,8 +1013,8 @@ struct smb_version_operations smb1_operations = { .query_path_info = cifs_query_path_info, .query_file_info = cifs_query_file_info, .get_srv_inum = cifs_get_srv_inum, - .set_path_size = smb_set_file_size, - .set_file_size = CIFSSMBSetFileSize, + .set_file_size_by_path = smb_set_file_size_by_path, + .set_file_size_by_handle = CIFSSMBSetFileSize, .set_file_info = smb_set_file_info, .set_compression = cifs_set_compression, .echo = CIFSSMBEcho, diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 84c012a..78b590f 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c @@ -244,7 +244,7 @@ smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, } int -smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon, +smb2_set_file_size_by_path(const unsigned int xid, struct cifs_tcon *tcon, const char *full_path, __u64 size, struct cifs_sb_info *cifs_sb, bool set_alloc) { diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 757da3e..dc7b1cb 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -688,7 +688,7 @@ smb2_sync_write(const unsigned int
[PATCH 4/5 linux-next V2] cifs: fix incorrect reference count check
The reference count on tlink can only be decremented if cifs_sb_tlink(cifs_sb) was used to acquire it. That only happens if open_file==NULL. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Cc: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V2 - this is a new patch in the V2 series. fs/cifs/inode.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 3f710c6..e332038 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -2007,7 +2007,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, CIFSSMBClose(xid, tcon, netfid); } } - if (tlink) + if (!open_file) cifs_put_tlink(tlink); set_size_out: -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/5 linux-next V2] cifs: Introduce cifs_legacy_set_file_size()
Consolidates some duplicate code. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Cc: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V2 - this is a new patch in the V2 series. fs/cifs/inode.c | 54 +- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 7181516..3f710c6 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,6 +1899,30 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } +/* + * Legacy hack to set file length. + */ +static int +cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, + unsigned int length, struct cifs_tcon *tcon, + char *full_path) +{ + int rc; + unsigned int bytes_written; + struct cifs_io_parms io_parms; + + io_parms.netfid = netfid; + io_parms.pid = pid; + io_parms.tcon = tcon; + io_parms.offset = 0; + io_parms.length = length; + rc = CIFSSMBWrite(xid, io_parms, bytes_written, + NULL, NULL, 1); + cifs_dbg(FYI, %s len %d rc %d on %s\n, __func__, length, rc, +full_path); + return rc; +} + static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) @@ -1910,7 +1934,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - struct cifs_io_parms io_parms; /* * To avoid spurious oplock breaks from server, in the case of @@ -1935,16 +1958,11 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifsFileInfo_put(open_file); cifs_dbg(FYI, SetFSize for attrs rc = %d\n, rc); if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { - unsigned int bytes_written; - - io_parms.netfid = open_file-fid.netfid; - io_parms.pid = open_file-pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = attrs-ia_size; - rc = CIFSSMBWrite(xid, io_parms, bytes_written, - NULL, NULL, 1); - cifs_dbg(FYI, Wrt seteof rc %d\n, rc); + rc = cifs_legacy_set_file_size(xid, + open_file-fid.netfid, + open_file-pid, + attrs-ia_size, + tcon, full_path); } } else rc = -EINVAL; @@ -1982,16 +2000,10 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, cifs_sb-mnt_cifs_flags CIFS_MOUNT_MAP_SPECIAL_CHR); if (rc == 0) { - unsigned int bytes_written; - - io_parms.netfid = netfid; - io_parms.pid = current-tgid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = attrs-ia_size; - rc = CIFSSMBWrite(xid, io_parms, bytes_written, NULL, - NULL, 1); - cifs_dbg(FYI, wrt seteof rc %d\n, rc); + rc = cifs_legacy_set_file_size(xid, netfid, + current-tgid, + attrs-ia_size, tcon, + full_path); CIFSSMBClose(xid, tcon, netfid); } } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5 linux-next V2] cifs: Combine set_file_size by handle and path into one function
As suggested by Jeff Layton: Now that I look though, it's clear to me that cifs_set_file_size is just wrong. Currently it calls ops-set_path_size and if that fails with certain error codes it tries to do a SMBLegacyOpen, etc. That's going to fall on its face if this is a SMB2/3 connection. Here's what should be done instead, I think: - get rid of both set_path_size and set_file_size operations. The version specific abstraction was implemented at the wrong level, IMO. - implement a new protocol level operation that basically takes the same args as cifs_set_file_size. cifs_setattr_unix/_nounix should call this operation. - the set_path_size operation for SMB1 should basically be the function that is cifs_set_file_size today (though that should probably be renamed). That function should be restructured to do the following: + look for an open filehandle + if there isn't one, open the file + call CIFSSMBSetFileSize + fall back to zero-length write if that fails + close the file if we opened it This patch also moves all of the SMBv1 legacy hacks from cifs_set_file_size() into the SMBv1 specific handler smb_set_file_size() more or less intact. SMBv2 and higher are more regular and orthogonal, so the v2 handler smb2_set_file_size() no longer contains the legacy hacks. Signed-off-by: Tim Gardner t...@tpi.com --- V2 - this is a new patch in the V2 series. I know this is kind of a giant patch, but there really doesn't seem to be any intermediate steps. Its pretty much all or nothing. I've only tested against a Linux CIFS server running a 3.2 kernel since I no longer have easy access to smbv2 servers (iOS 10.8 or Windows 7). rtg fs/cifs/cifsglob.h |9 ++--- fs/cifs/inode.c| 108 +-- fs/cifs/smb1ops.c | 109 +++- fs/cifs/smb2ops.c | 57 --- 4 files changed, 170 insertions(+), 113 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8fd8eb2..6113ce8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -269,12 +269,9 @@ struct smb_version_operations { int (*get_srv_inum)(const unsigned int, struct cifs_tcon *, struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); - /* set size by path */ - int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, -const char *, __u64, struct cifs_sb_info *, bool); - /* set size by file handle */ - int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, -struct cifsFileInfo *, __u64, bool); + /* set file size */ + int (*set_file_size)(struct inode *inode, struct iattr *attrs, +unsigned int xid, char *full_path); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, const unsigned int); diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index e332038..3edeafd 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,118 +1899,28 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } -/* - * Legacy hack to set file length. - */ -static int -cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, - unsigned int length, struct cifs_tcon *tcon, - char *full_path) -{ - int rc; - unsigned int bytes_written; - struct cifs_io_parms io_parms; - - io_parms.netfid = netfid; - io_parms.pid = pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = length; - rc = CIFSSMBWrite(xid, io_parms, bytes_written, - NULL, NULL, 1); - cifs_dbg(FYI, %s len %d rc %d on %s\n, __func__, length, rc, -full_path); - return rc; -} - static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) { - int rc; - struct cifsFileInfo *open_file; + int rc = -ENOSYS; struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifs_sb_info *cifs_sb = CIFS_SB(inode-i_sb); struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - /* -* To avoid spurious oplock breaks from server, in the case of -* inodes that we already have open, avoid doing path based -* setting of file size if we can do it by handle. -* This keeps our caching token (oplock) and avoids timeouts -* when the local oplock break takes longer to flush -* writebehind data than the SMB timeout for the SetPathInfo -* request would allow -*/ - open_file = find_writable_file(cifsInode, true
[PATCH 5/5 linux-next V2 (resend)] cifs: Combine set_file_size by handle and path into one function
As suggested by Jeff Layton: Now that I look though, it's clear to me that cifs_set_file_size is just wrong. Currently it calls ops-set_path_size and if that fails with certain error codes it tries to do a SMBLegacyOpen, etc. That's going to fall on its face if this is a SMB2/3 connection. Here's what should be done instead, I think: - get rid of both set_path_size and set_file_size operations. The version specific abstraction was implemented at the wrong level, IMO. - implement a new protocol level operation that basically takes the same args as cifs_set_file_size. cifs_setattr_unix/_nounix should call this operation. - the set_path_size operation for SMB1 should basically be the function that is cifs_set_file_size today (though that should probably be renamed). That function should be restructured to do the following: + look for an open filehandle + if there isn't one, open the file + call CIFSSMBSetFileSize + fall back to zero-length write if that fails + close the file if we opened it This patch also moves all of the SMBv1 legacy hacks from cifs_set_file_size() into the SMBv1 specific handler smb_set_file_size() more or less intact. SMBv2 and higher are more regular and orthogonal, so the v2 handler smb2_set_file_size() no longer contains the legacy hacks. Cc: Steve French sfre...@samba.org Cc: Jeff Layton jlay...@redhat.com Cc: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- V2 - this is a new patch in the V2 series. I know this is kind of a giant patch, but there really doesn't seem to be any intermediate steps. Its pretty much all or nothing. I've only tested against a Linux CIFS server running a 3.2 kernel since I no longer have easy access to smbv2 servers (iOS 10.8 or Windows 7). resent with corrected Cc's rtg fs/cifs/cifsglob.h |9 ++--- fs/cifs/inode.c| 108 +-- fs/cifs/smb1ops.c | 109 +++- fs/cifs/smb2ops.c | 57 --- 4 files changed, 170 insertions(+), 113 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8fd8eb2..6113ce8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -269,12 +269,9 @@ struct smb_version_operations { int (*get_srv_inum)(const unsigned int, struct cifs_tcon *, struct cifs_sb_info *, const char *, u64 *uniqueid, FILE_ALL_INFO *); - /* set size by path */ - int (*set_file_size_by_path)(const unsigned int, struct cifs_tcon *, -const char *, __u64, struct cifs_sb_info *, bool); - /* set size by file handle */ - int (*set_file_size_by_handle)(const unsigned int, struct cifs_tcon *, -struct cifsFileInfo *, __u64, bool); + /* set file size */ + int (*set_file_size)(struct inode *inode, struct iattr *attrs, +unsigned int xid, char *full_path); /* set attributes */ int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *, const unsigned int); diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index e332038..3edeafd 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1899,118 +1899,28 @@ static void cifs_setsize(struct inode *inode, loff_t offset) truncate_pagecache(inode, offset); } -/* - * Legacy hack to set file length. - */ -static int -cifs_legacy_set_file_size(unsigned int xid, __u16 netfid, __u32 pid, - unsigned int length, struct cifs_tcon *tcon, - char *full_path) -{ - int rc; - unsigned int bytes_written; - struct cifs_io_parms io_parms; - - io_parms.netfid = netfid; - io_parms.pid = pid; - io_parms.tcon = tcon; - io_parms.offset = 0; - io_parms.length = length; - rc = CIFSSMBWrite(xid, io_parms, bytes_written, - NULL, NULL, 1); - cifs_dbg(FYI, %s len %d rc %d on %s\n, __func__, length, rc, -full_path); - return rc; -} - static int cifs_set_file_size(struct inode *inode, struct iattr *attrs, unsigned int xid, char *full_path) { - int rc; - struct cifsFileInfo *open_file; + int rc = -ENOSYS; struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifs_sb_info *cifs_sb = CIFS_SB(inode-i_sb); struct tcon_link *tlink = NULL; struct cifs_tcon *tcon = NULL; struct TCP_Server_Info *server; - /* -* To avoid spurious oplock breaks from server, in the case of -* inodes that we already have open, avoid doing path based -* setting of file size if we can do it by handle. -* This keeps our caching token (oplock) and avoids timeouts -* when the local oplock break takes longer to flush -* writebehind data than
[PATCH linux-next] cifs: Replace CIFSSMBSetEOF() with smb_set_file_size()
0x27, smb_buf_length: 0x23 [179777.461280] fs/cifs/transport.c:cifs_sync_mid_result:571: cifs_sync_mid_result: cmd=4 mid=22 state=4 Cc: Jeff Layton Cc: Steve French Signed-off-by: Dean Gehnert Signed-off-by: Tim Gardner --- We encountered this problem whilst backporting the CIFS driver to a kernel and VFS old enough to still call inode_operations.setattr() when truncating a file. We're not sure it is the right upstream solution, but it worked for us on this older kernel. fs/cifs/cifsproto.h | 3 -- fs/cifs/cifssmb.c | 98 - fs/cifs/smb1ops.c | 36 +++- 3 files changed, 35 insertions(+), 102 deletions(-) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index aa33976..fe69b9c 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -296,9 +296,6 @@ extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon, char *fileName, __u16 dos_attributes, const struct nls_table *nls_codepage); #endif /* possibly unneeded function */ -extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, -const char *file_name, __u64 size, -struct cifs_sb_info *cifs_sb, bool set_allocation); extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, struct cifsFileInfo *cfile, __u64 size, bool set_allocation); diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 124aa02..53f1b9b 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -5453,104 +5453,6 @@ QFSPosixRetry: return rc; } - -/* - * We can not use write of zero bytes trick to set file size due to need for - * large file support. Also note that this SetPathInfo is preferred to - * SetFileInfo based method in next routine which is only needed to work around - * a sharing violation bugin Samba which this routine can run into. - */ -int -CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, - const char *file_name, __u64 size, struct cifs_sb_info *cifs_sb, - bool set_allocation) -{ - struct smb_com_transaction2_spi_req *pSMB = NULL; - struct smb_com_transaction2_spi_rsp *pSMBr = NULL; - struct file_end_of_file_info *parm_data; - int name_len; - int rc = 0; - int bytes_returned = 0; - int remap = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR; - - __u16 params, byte_count, data_count, param_offset, offset; - - cifs_dbg(FYI, "In SetEOF\n"); -SetEOFRetry: - rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) , - (void **) ); - if (rc) - return rc; - - if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { - name_len = - cifsConvertToUTF16((__le16 *) pSMB->FileName, file_name, - PATH_MAX, cifs_sb->local_nls, remap); - name_len++; /* trailing null */ - name_len *= 2; - } else {/* BB improve the check for buffer overruns BB */ - name_len = strnlen(file_name, PATH_MAX); - name_len++; /* trailing null */ - strncpy(pSMB->FileName, file_name, name_len); - } - params = 6 + name_len; - data_count = sizeof(struct file_end_of_file_info); - pSMB->MaxParameterCount = cpu_to_le16(2); - pSMB->MaxDataCount = cpu_to_le16(4100); - pSMB->MaxSetupCount = 0; - pSMB->Reserved = 0; - pSMB->Flags = 0; - pSMB->Timeout = 0; - pSMB->Reserved2 = 0; - param_offset = offsetof(struct smb_com_transaction2_spi_req, - InformationLevel) - 4; - offset = param_offset + params; - if (set_allocation) { - if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); - else - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO); - } else /* Set File Size */ { - if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO2); - else - pSMB->InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); - } - - parm_data = - (struct file_end_of_file_info *) (((char *) >hdr.Protocol) + - offset); - pSMB->ParameterOffset = cpu_to_le16(param_offset); - pSMB->DataOffset = cpu_to_le16(offset); - pSMB->SetupCount = 1; - pSMB->Reserved3 = 0; - pSM
[PATCH linux-next] cifs: Replace CIFSSMBSetEOF() with smb_set_file_size()
/transport.c:cifs_sync_mid_result:571: cifs_sync_mid_result: cmd=4 mid=22 state=4 Cc: Jeff Layton jlay...@redhat.com Cc: Steve French sfre...@samba.org Signed-off-by: Dean Gehnert de...@tpi.com Signed-off-by: Tim Gardner t...@tpi.com --- We encountered this problem whilst backporting the CIFS driver to a kernel and VFS old enough to still call inode_operations.setattr() when truncating a file. We're not sure it is the right upstream solution, but it worked for us on this older kernel. fs/cifs/cifsproto.h | 3 -- fs/cifs/cifssmb.c | 98 - fs/cifs/smb1ops.c | 36 +++- 3 files changed, 35 insertions(+), 102 deletions(-) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index aa33976..fe69b9c 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -296,9 +296,6 @@ extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon, char *fileName, __u16 dos_attributes, const struct nls_table *nls_codepage); #endif /* possibly unneeded function */ -extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, -const char *file_name, __u64 size, -struct cifs_sb_info *cifs_sb, bool set_allocation); extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, struct cifsFileInfo *cfile, __u64 size, bool set_allocation); diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 124aa02..53f1b9b 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -5453,104 +5453,6 @@ QFSPosixRetry: return rc; } - -/* - * We can not use write of zero bytes trick to set file size due to need for - * large file support. Also note that this SetPathInfo is preferred to - * SetFileInfo based method in next routine which is only needed to work around - * a sharing violation bugin Samba which this routine can run into. - */ -int -CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, - const char *file_name, __u64 size, struct cifs_sb_info *cifs_sb, - bool set_allocation) -{ - struct smb_com_transaction2_spi_req *pSMB = NULL; - struct smb_com_transaction2_spi_rsp *pSMBr = NULL; - struct file_end_of_file_info *parm_data; - int name_len; - int rc = 0; - int bytes_returned = 0; - int remap = cifs_sb-mnt_cifs_flags CIFS_MOUNT_MAP_SPECIAL_CHR; - - __u16 params, byte_count, data_count, param_offset, offset; - - cifs_dbg(FYI, In SetEOF\n); -SetEOFRetry: - rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) pSMB, - (void **) pSMBr); - if (rc) - return rc; - - if (pSMB-hdr.Flags2 SMBFLG2_UNICODE) { - name_len = - cifsConvertToUTF16((__le16 *) pSMB-FileName, file_name, - PATH_MAX, cifs_sb-local_nls, remap); - name_len++; /* trailing null */ - name_len *= 2; - } else {/* BB improve the check for buffer overruns BB */ - name_len = strnlen(file_name, PATH_MAX); - name_len++; /* trailing null */ - strncpy(pSMB-FileName, file_name, name_len); - } - params = 6 + name_len; - data_count = sizeof(struct file_end_of_file_info); - pSMB-MaxParameterCount = cpu_to_le16(2); - pSMB-MaxDataCount = cpu_to_le16(4100); - pSMB-MaxSetupCount = 0; - pSMB-Reserved = 0; - pSMB-Flags = 0; - pSMB-Timeout = 0; - pSMB-Reserved2 = 0; - param_offset = offsetof(struct smb_com_transaction2_spi_req, - InformationLevel) - 4; - offset = param_offset + params; - if (set_allocation) { - if (tcon-ses-capabilities CAP_INFOLEVEL_PASSTHRU) - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); - else - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO); - } else /* Set File Size */ { - if (tcon-ses-capabilities CAP_INFOLEVEL_PASSTHRU) - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO2); - else - pSMB-InformationLevel = - cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); - } - - parm_data = - (struct file_end_of_file_info *) (((char *) pSMB-hdr.Protocol) + - offset); - pSMB-ParameterOffset = cpu_to_le16(param_offset); - pSMB-DataOffset = cpu_to_le16(offset); - pSMB-SetupCount = 1; - pSMB-Reserved3 = 0; - pSMB-SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - byte_count = 3 /* pad */ + params + data_count
Re: [PATCH linux-next] SELinux: security_load_policy: Silence frame-larger-than warning
On 11/19/2013 02:38 PM, Paul Moore wrote: > On Thursday, November 14, 2013 03:04:51 PM Tim Gardner wrote: >> Dynamically allocate a couple of the larger stack variables in order to >> reduce the stack footprint below 1024. gcc-4.8 >> >> security/selinux/ss/services.c: In function 'security_load_policy': >> security/selinux/ss/services.c:1964:1: warning: the frame size of 1104 bytes >> is larger than 1024 bytes [-Wframe-larger-than=] } >> >> Also silence a couple of checkpatch warnings at the same time. >> >> WARNING: sizeof policydb should be sizeof(policydb) >> +memcpy(oldpolicydb, , sizeof policydb); >> >> WARNING: sizeof policydb should be sizeof(policydb) >> +memcpy(, newpolicydb, sizeof policydb); >> >> Cc: Stephen Smalley >> Cc: James Morris >> Cc: Eric Paris >> Signed-off-by: Tim Gardner >> --- >> security/selinux/ss/services.c | 54 ++-- >> 1 file changed, 32 insertions(+), 22 deletions(-) > > Applied, thanks. It will be pushed to my next tree once -rc1 is released. > > In the future, please send SELinux patches to the SELinux mailing list. > It is difficult to know where to send a patch for every subsystem. I've been using the get_maintainer.pl script, so perhaps the info in MAINTAINERS is stale ? I'm open to suggestions. $: scripts/get_maintainer.pl -f security/selinux/ss/services.c Stephen Smalley (supporter:SELINUX SECURITY...) James Morris (supporter:SELINUX SECURITY...) Eric Paris (supporter:SELINUX SECURITY...) linux-security-mod...@vger.kernel.org (open list:SECURITY SUBSYSTEM) linux-kernel@vger.kernel.org (open list) rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH linux-next] SELinux: security_load_policy: Silence frame-larger-than warning
On 11/19/2013 02:38 PM, Paul Moore wrote: On Thursday, November 14, 2013 03:04:51 PM Tim Gardner wrote: Dynamically allocate a couple of the larger stack variables in order to reduce the stack footprint below 1024. gcc-4.8 security/selinux/ss/services.c: In function 'security_load_policy': security/selinux/ss/services.c:1964:1: warning: the frame size of 1104 bytes is larger than 1024 bytes [-Wframe-larger-than=] } Also silence a couple of checkpatch warnings at the same time. WARNING: sizeof policydb should be sizeof(policydb) +memcpy(oldpolicydb, policydb, sizeof policydb); WARNING: sizeof policydb should be sizeof(policydb) +memcpy(policydb, newpolicydb, sizeof policydb); Cc: Stephen Smalley s...@tycho.nsa.gov Cc: James Morris james.l.mor...@oracle.com Cc: Eric Paris epa...@parisplace.org Signed-off-by: Tim Gardner tim.gard...@canonical.com --- security/selinux/ss/services.c | 54 ++-- 1 file changed, 32 insertions(+), 22 deletions(-) Applied, thanks. It will be pushed to my next tree once -rc1 is released. In the future, please send SELinux patches to the SELinux mailing list. It is difficult to know where to send a patch for every subsystem. I've been using the get_maintainer.pl script, so perhaps the info in MAINTAINERS is stale ? I'm open to suggestions. $: scripts/get_maintainer.pl -f security/selinux/ss/services.c Stephen Smalley s...@tycho.nsa.gov (supporter:SELINUX SECURITY...) James Morris james.l.mor...@oracle.com (supporter:SELINUX SECURITY...) Eric Paris epa...@parisplace.org (supporter:SELINUX SECURITY...) linux-security-mod...@vger.kernel.org (open list:SECURITY SUBSYSTEM) linux-kernel@vger.kernel.org (open list) rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3.13-rc1] xen-blkfront: Silence pfn maybe-uninitialized warning
On 11/14/2013 02:24 PM, Konrad Rzeszutek Wilk wrote: > Tim Gardner wrote: >> pfn cannot actually be used unless (!info->feature_persistent), nor >> is pfn accessed in get_grant() unless (!info->feature_persistent), >> but silence this warning anyway. gcc-4.8 >> >> drivers/block/xen-blkfront.c: In function 'do_blkif_request': >> drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used >> uninitialized in this function [-Wmaybe-uninitialized] >> gnt_list_entry = get_grant(_head, pfn, info); ^ >> drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here >> unsigned long pfn; >> >> Cc: Konrad Rzeszutek Wilk Cc: Boris >> Ostrovsky Cc: David Vrabel >> Signed-off-by: Tim Gardner >> --- drivers/block/xen-blkfront.c |2 >> +- 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/block/xen-blkfront.c >> b/drivers/block/xen-blkfront.c index 432db1b..5f926de 100644 --- >> a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c >> @@ -489,7 +489,7 @@ static int blkif_queue_request(struct request >> *req) >> >> if ((ring_req->operation == BLKIF_OP_INDIRECT) && (i % >> SEGS_PER_INDIRECT_FRAME == 0)) { - unsigned long >> pfn; + >> unsigned long uninitialized_var(pfn); >> >> if (segments) kunmap_atomic(segments); > > I have a similar patch from Roger that sets pfn=0. > > Roger could you repost your patch please or if you feel that this > patch makes sense then comment on it? > > Thanks. > The advantage of uninitialized_var() is that it doesn't actually generate any code (or so it says in the header). rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH linux-next] SELinux: security_load_policy: Silence frame-larger-than warning
Dynamically allocate a couple of the larger stack variables in order to reduce the stack footprint below 1024. gcc-4.8 security/selinux/ss/services.c: In function 'security_load_policy': security/selinux/ss/services.c:1964:1: warning: the frame size of 1104 bytes is larger than 1024 bytes [-Wframe-larger-than=] } Also silence a couple of checkpatch warnings at the same time. WARNING: sizeof policydb should be sizeof(policydb) + memcpy(oldpolicydb, , sizeof policydb); WARNING: sizeof policydb should be sizeof(policydb) + memcpy(, newpolicydb, sizeof policydb); Cc: Stephen Smalley Cc: James Morris Cc: Eric Paris Signed-off-by: Tim Gardner --- security/selinux/ss/services.c | 54 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index b4feecc..c8317c8 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -1828,7 +1828,7 @@ static int security_preserve_bools(struct policydb *p); */ int security_load_policy(void *data, size_t len) { - struct policydb oldpolicydb, newpolicydb; + struct policydb *oldpolicydb, *newpolicydb; struct sidtab oldsidtab, newsidtab; struct selinux_mapping *oldmap, *map = NULL; struct convert_context_args args; @@ -1837,12 +1837,19 @@ int security_load_policy(void *data, size_t len) int rc = 0; struct policy_file file = { data, len }, *fp = + oldpolicydb = kzalloc(2 * sizeof(*oldpolicydb), GFP_KERNEL); + if (!oldpolicydb) { + rc = -ENOMEM; + goto out; + } + newpolicydb = oldpolicydb + 1; + if (!ss_initialized) { avtab_cache_init(); rc = policydb_read(, fp); if (rc) { avtab_cache_destroy(); - return rc; + goto out; } policydb.len = len; @@ -1852,14 +1859,14 @@ int security_load_policy(void *data, size_t len) if (rc) { policydb_destroy(); avtab_cache_destroy(); - return rc; + goto out; } rc = policydb_load_isids(, ); if (rc) { policydb_destroy(); avtab_cache_destroy(); - return rc; + goto out; } security_load_policycaps(); @@ -1871,36 +1878,36 @@ int security_load_policy(void *data, size_t len) selinux_status_update_policyload(seqno); selinux_netlbl_cache_invalidate(); selinux_xfrm_notify_policyload(); - return 0; + goto out; } #if 0 sidtab_hash_eval(, "sids"); #endif - rc = policydb_read(, fp); + rc = policydb_read(newpolicydb, fp); if (rc) - return rc; + goto out; - newpolicydb.len = len; + newpolicydb->len = len; /* If switching between different policy types, log MLS status */ - if (policydb.mls_enabled && !newpolicydb.mls_enabled) + if (policydb.mls_enabled && !newpolicydb->mls_enabled) printk(KERN_INFO "SELinux: Disabling MLS support...\n"); - else if (!policydb.mls_enabled && newpolicydb.mls_enabled) + else if (!policydb.mls_enabled && newpolicydb->mls_enabled) printk(KERN_INFO "SELinux: Enabling MLS support...\n"); - rc = policydb_load_isids(, ); + rc = policydb_load_isids(newpolicydb, ); if (rc) { printk(KERN_ERR "SELinux: unable to load the initial SIDs\n"); - policydb_destroy(); - return rc; + policydb_destroy(newpolicydb); + goto out; } - rc = selinux_set_mapping(, secclass_map, , _size); + rc = selinux_set_mapping(newpolicydb, secclass_map, , _size); if (rc) goto err; - rc = security_preserve_bools(); + rc = security_preserve_bools(newpolicydb); if (rc) { printk(KERN_ERR "SELinux: unable to preserve booleans\n"); goto err; @@ -1918,7 +1925,7 @@ int security_load_policy(void *data, size_t len) * in the new SID table. */ args.oldp = - args.newp = + args.newp = newpolicydb; rc = sidtab_map(, convert_context, ); if (rc) { printk(KERN_ERR "SELinux: unable to convert the internal" @@ -1928,12 +1935,12 @@ int security_load_policy(void *data, size_t len) } /* Save the old policydb and SID table to free later. */ - memcpy(, , sizeof policydb); + memcpy(ol
[PATCH 3.13-rc1] xen-blkfront: Silence pfn maybe-uninitialized warning
pfn cannot actually be used unless (!info->feature_persistent), nor is pfn accessed in get_grant() unless (!info->feature_persistent), but silence this warning anyway. gcc-4.8 drivers/block/xen-blkfront.c: In function 'do_blkif_request': drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized] gnt_list_entry = get_grant(_head, pfn, info); ^ drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here unsigned long pfn; Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: David Vrabel Signed-off-by: Tim Gardner --- drivers/block/xen-blkfront.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 432db1b..5f926de 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req) if ((ring_req->operation == BLKIF_OP_INDIRECT) && (i % SEGS_PER_INDIRECT_FRAME == 0)) { - unsigned long pfn; + unsigned long uninitialized_var(pfn); if (segments) kunmap_atomic(segments); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.13-rc1] xen-blkfront: Silence pfn maybe-uninitialized warning
pfn cannot actually be used unless (!info-feature_persistent), nor is pfn accessed in get_grant() unless (!info-feature_persistent), but silence this warning anyway. gcc-4.8 drivers/block/xen-blkfront.c: In function 'do_blkif_request': drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized] gnt_list_entry = get_grant(gref_head, pfn, info); ^ drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here unsigned long pfn; Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Boris Ostrovsky boris.ostrov...@oracle.com Cc: David Vrabel david.vra...@citrix.com Signed-off-by: Tim Gardner tim.gard...@canonical.com --- drivers/block/xen-blkfront.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 432db1b..5f926de 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req) if ((ring_req-operation == BLKIF_OP_INDIRECT) (i % SEGS_PER_INDIRECT_FRAME == 0)) { - unsigned long pfn; + unsigned long uninitialized_var(pfn); if (segments) kunmap_atomic(segments); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH linux-next] SELinux: security_load_policy: Silence frame-larger-than warning
Dynamically allocate a couple of the larger stack variables in order to reduce the stack footprint below 1024. gcc-4.8 security/selinux/ss/services.c: In function 'security_load_policy': security/selinux/ss/services.c:1964:1: warning: the frame size of 1104 bytes is larger than 1024 bytes [-Wframe-larger-than=] } Also silence a couple of checkpatch warnings at the same time. WARNING: sizeof policydb should be sizeof(policydb) + memcpy(oldpolicydb, policydb, sizeof policydb); WARNING: sizeof policydb should be sizeof(policydb) + memcpy(policydb, newpolicydb, sizeof policydb); Cc: Stephen Smalley s...@tycho.nsa.gov Cc: James Morris james.l.mor...@oracle.com Cc: Eric Paris epa...@parisplace.org Signed-off-by: Tim Gardner tim.gard...@canonical.com --- security/selinux/ss/services.c | 54 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index b4feecc..c8317c8 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -1828,7 +1828,7 @@ static int security_preserve_bools(struct policydb *p); */ int security_load_policy(void *data, size_t len) { - struct policydb oldpolicydb, newpolicydb; + struct policydb *oldpolicydb, *newpolicydb; struct sidtab oldsidtab, newsidtab; struct selinux_mapping *oldmap, *map = NULL; struct convert_context_args args; @@ -1837,12 +1837,19 @@ int security_load_policy(void *data, size_t len) int rc = 0; struct policy_file file = { data, len }, *fp = file; + oldpolicydb = kzalloc(2 * sizeof(*oldpolicydb), GFP_KERNEL); + if (!oldpolicydb) { + rc = -ENOMEM; + goto out; + } + newpolicydb = oldpolicydb + 1; + if (!ss_initialized) { avtab_cache_init(); rc = policydb_read(policydb, fp); if (rc) { avtab_cache_destroy(); - return rc; + goto out; } policydb.len = len; @@ -1852,14 +1859,14 @@ int security_load_policy(void *data, size_t len) if (rc) { policydb_destroy(policydb); avtab_cache_destroy(); - return rc; + goto out; } rc = policydb_load_isids(policydb, sidtab); if (rc) { policydb_destroy(policydb); avtab_cache_destroy(); - return rc; + goto out; } security_load_policycaps(); @@ -1871,36 +1878,36 @@ int security_load_policy(void *data, size_t len) selinux_status_update_policyload(seqno); selinux_netlbl_cache_invalidate(); selinux_xfrm_notify_policyload(); - return 0; + goto out; } #if 0 sidtab_hash_eval(sidtab, sids); #endif - rc = policydb_read(newpolicydb, fp); + rc = policydb_read(newpolicydb, fp); if (rc) - return rc; + goto out; - newpolicydb.len = len; + newpolicydb-len = len; /* If switching between different policy types, log MLS status */ - if (policydb.mls_enabled !newpolicydb.mls_enabled) + if (policydb.mls_enabled !newpolicydb-mls_enabled) printk(KERN_INFO SELinux: Disabling MLS support...\n); - else if (!policydb.mls_enabled newpolicydb.mls_enabled) + else if (!policydb.mls_enabled newpolicydb-mls_enabled) printk(KERN_INFO SELinux: Enabling MLS support...\n); - rc = policydb_load_isids(newpolicydb, newsidtab); + rc = policydb_load_isids(newpolicydb, newsidtab); if (rc) { printk(KERN_ERR SELinux: unable to load the initial SIDs\n); - policydb_destroy(newpolicydb); - return rc; + policydb_destroy(newpolicydb); + goto out; } - rc = selinux_set_mapping(newpolicydb, secclass_map, map, map_size); + rc = selinux_set_mapping(newpolicydb, secclass_map, map, map_size); if (rc) goto err; - rc = security_preserve_bools(newpolicydb); + rc = security_preserve_bools(newpolicydb); if (rc) { printk(KERN_ERR SELinux: unable to preserve booleans\n); goto err; @@ -1918,7 +1925,7 @@ int security_load_policy(void *data, size_t len) * in the new SID table. */ args.oldp = policydb; - args.newp = newpolicydb; + args.newp = newpolicydb; rc = sidtab_map(newsidtab, convert_context, args); if (rc) { printk(KERN_ERR SELinux: unable to convert the internal @@ -1928,12 +1935,12 @@ int security_load_policy(void *data
Re: [PATCH 3.13-rc1] xen-blkfront: Silence pfn maybe-uninitialized warning
On 11/14/2013 02:24 PM, Konrad Rzeszutek Wilk wrote: Tim Gardner tim.gard...@canonical.com wrote: pfn cannot actually be used unless (!info-feature_persistent), nor is pfn accessed in get_grant() unless (!info-feature_persistent), but silence this warning anyway. gcc-4.8 drivers/block/xen-blkfront.c: In function 'do_blkif_request': drivers/block/xen-blkfront.c:508:20: warning: 'pfn' may be used uninitialized in this function [-Wmaybe-uninitialized] gnt_list_entry = get_grant(gref_head, pfn, info); ^ drivers/block/xen-blkfront.c:492:19: note: 'pfn' was declared here unsigned long pfn; Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Boris Ostrovsky boris.ostrov...@oracle.com Cc: David Vrabel david.vra...@citrix.com Signed-off-by: Tim Gardner tim.gard...@canonical.com --- drivers/block/xen-blkfront.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 432db1b..5f926de 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req) if ((ring_req-operation == BLKIF_OP_INDIRECT) (i % SEGS_PER_INDIRECT_FRAME == 0)) { - unsigned long pfn; + unsigned long uninitialized_var(pfn); if (segments) kunmap_atomic(segments); I have a similar patch from Roger that sets pfn=0. Roger could you repost your patch please or if you feel that this patch makes sense then comment on it? Thanks. The advantage of uninitialized_var() is that it doesn't actually generate any code (or so it says in the header). rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH linux-next] cifs: Use data structures to compute NTLMv2 response offsets
On 11/08/2013 01:19 PM, Shirish Pargaonkar wrote: > Looks correct. You may want to verify that the code works fine for both > sec=ntlmssp/ntlmsspi and sec=ntlmv2/ntlmv2i mount options. > > Reviewed-by: Shirish Pargaonkar > These are the mount attempt results using a stock 3.12 kernel built with the Ubuntu Trusty config. I am not well versed enough in the various security mechanisms to know what should work. mount sec=ntlmssp on WinPro8 success mount sec=ntlmsspi on WinPro8 failure mount sec=ntlmv2 on WinPro8 failure mount sec=ntlmv2i on WinPro8 failure mount sec=ntlmssp on iOS-10.8 success mount sec=ntlmsspi on iOS-10.8 success mount sec=ntlmv2 on iOS-10.8 failure mount sec=ntlmv2i on iOS-10.8 failure mount sec=ntlmssp on Linux-3.2 success mount sec=ntlmsspi on Linux-3.2 failure mount sec=ntlmv2 on Linux-3.2 success mount sec=ntlmv2i on Linux-3.2 failure The mount parameters used were '-o noserverino,nounix,user=test,pass=test'. For example, sudo mount -t cifs //10.0.0.182/test /tmp/mnt -o noserverino,nounix,user=test,pass=test,sec=ntlmssp The patched kernel produced identical results. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH linux-next] cifs: Use data structures to compute NTLMv2 response offsets
On 11/08/2013 01:19 PM, Shirish Pargaonkar wrote: Looks correct. You may want to verify that the code works fine for both sec=ntlmssp/ntlmsspi and sec=ntlmv2/ntlmv2i mount options. Reviewed-by: Shirish Pargaonkar spargaon...@suse.com These are the mount attempt results using a stock 3.12 kernel built with the Ubuntu Trusty config. I am not well versed enough in the various security mechanisms to know what should work. mount sec=ntlmssp on WinPro8 success mount sec=ntlmsspi on WinPro8 failure mount sec=ntlmv2 on WinPro8 failure mount sec=ntlmv2i on WinPro8 failure mount sec=ntlmssp on iOS-10.8 success mount sec=ntlmsspi on iOS-10.8 success mount sec=ntlmv2 on iOS-10.8 failure mount sec=ntlmv2i on iOS-10.8 failure mount sec=ntlmssp on Linux-3.2 success mount sec=ntlmsspi on Linux-3.2 failure mount sec=ntlmv2 on Linux-3.2 success mount sec=ntlmv2i on Linux-3.2 failure The mount parameters used were '-o noserverino,nounix,user=test,pass=test'. For example, sudo mount -t cifs //10.0.0.182/test /tmp/mnt -o noserverino,nounix,user=test,pass=test,sec=ntlmssp The patched kernel produced identical results. rtg -- Tim Gardner tim.gard...@canonical.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH linux-next] cifs: Use data structures to compute NTLMv2 response offsets
A bit of cleanup plus some gratuitous variable renaming. I think using structures instead of numeric offsets makes this code much more understandable. Also added a comment about current time range expected by the server. Cc: Jeff Layton Cc: Steve French Signed-off-by: Tim Gardner --- The comment about time of day needing to be within 5 minutes is important (to me at least). I spent the best part of a week thinking I had endian issues on powerpc when in truth I was just too stupid to notice that the clock was not updated. Danged embedded platforms... checkpatch has some problems with this patch regarding attribute packed, but I chose to remain consistent with existing code. WARNING: __packed is preferred over __attribute__((packed)) #141: FILE: fs/cifs/cifspdu.h:705: + } __attribute__((packed)) challenge; WARNING: __packed is preferred over __attribute__((packed)) #142: FILE: fs/cifs/cifspdu.h:706: + } __attribute__((packed)); total: 0 errors, 2 warnings, 99 lines checked Tested on cifs-2.6 for-linus (c481e9feee78c6ce1ba0a1c8c892049f6514f6cf) by mounting to iOS 10.8 and Win 8.0 Pro. rtg fs/cifs/cifsencrypt.c | 40 fs/cifs/cifspdu.h |8 +++- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index fc6f4f3..4934347 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -548,7 +548,13 @@ static int CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) { int rc; - unsigned int offset = CIFS_SESS_KEY_SIZE + 8; + struct ntlmv2_resp *ntlmv2 = (struct ntlmv2_resp *) + (ses->auth_key.response + CIFS_SESS_KEY_SIZE); + unsigned int hash_len; + + /* The MD5 hash starts at challenge_key.key */ + hash_len = ses->auth_key.len - (CIFS_SESS_KEY_SIZE + + offsetof(struct ntlmv2_resp, challenge.key[0])); if (!ses->server->secmech.sdeschmacmd5) { cifs_dbg(VFS, "%s: can't generate ntlmv2 hash\n", __func__); @@ -556,7 +562,7 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) } rc = crypto_shash_setkey(ses->server->secmech.hmacmd5, - ntlmv2_hash, CIFS_HMAC_MD5_HASH_SIZE); +ntlmv2_hash, CIFS_HMAC_MD5_HASH_SIZE); if (rc) { cifs_dbg(VFS, "%s: Could not set NTLMV2 Hash as a key\n", __func__); @@ -570,20 +576,21 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) } if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) - memcpy(ses->auth_key.response + offset, - ses->ntlmssp->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); + memcpy(ntlmv2->challenge.key, + ses->ntlmssp->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); else - memcpy(ses->auth_key.response + offset, - ses->server->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); + memcpy(ntlmv2->challenge.key, + ses->server->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); rc = crypto_shash_update(>server->secmech.sdeschmacmd5->shash, - ses->auth_key.response + offset, ses->auth_key.len - offset); +ntlmv2->challenge.key, hash_len); if (rc) { cifs_dbg(VFS, "%s: Could not update with response\n", __func__); return rc; } + /* Note that the MD5 digest over writes anon.challenge_key.key */ rc = crypto_shash_final(>server->secmech.sdeschmacmd5->shash, - ses->auth_key.response + CIFS_SESS_KEY_SIZE); + ntlmv2->ntlmv2_hash); if (rc) cifs_dbg(VFS, "%s: Could not generate md5 hash\n", __func__); @@ -627,7 +634,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) int rc; int baselen; unsigned int tilen; - struct ntlmv2_resp *buf; + struct ntlmv2_resp *ntlmv2; char ntlmv2_hash[16]; unsigned char *tiblob = NULL; /* target info blob */ @@ -660,13 +667,14 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) } ses->auth_key.len += baselen; - buf = (struct ntlmv2_resp *) + ntlmv2 = (struct ntlmv2_resp *) (ses->auth_key.response + CIFS_SESS_KEY_SIZE); - buf->blob_signature = cpu_to_le32(0x0101); - buf->reserved = 0; - buf->time = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); - get_random_bytes(>client_chal, sizeof(buf->client_chal)); - buf->reserved2 = 0; + ntlmv2->blob_signature = cpu_to_le32(0x0101); + ntlmv2-&
[PATCH linux-next] cifs: Use data structures to compute NTLMv2 response offsets
A bit of cleanup plus some gratuitous variable renaming. I think using structures instead of numeric offsets makes this code much more understandable. Also added a comment about current time range expected by the server. Cc: Jeff Layton jlay...@redhat.com Cc: Steve French sfre...@samba.org Signed-off-by: Tim Gardner tim.gard...@canonical.com --- The comment about time of day needing to be within 5 minutes is important (to me at least). I spent the best part of a week thinking I had endian issues on powerpc when in truth I was just too stupid to notice that the clock was not updated. Danged embedded platforms... checkpatch has some problems with this patch regarding attribute packed, but I chose to remain consistent with existing code. WARNING: __packed is preferred over __attribute__((packed)) #141: FILE: fs/cifs/cifspdu.h:705: + } __attribute__((packed)) challenge; WARNING: __packed is preferred over __attribute__((packed)) #142: FILE: fs/cifs/cifspdu.h:706: + } __attribute__((packed)); total: 0 errors, 2 warnings, 99 lines checked Tested on cifs-2.6 for-linus (c481e9feee78c6ce1ba0a1c8c892049f6514f6cf) by mounting to iOS 10.8 and Win 8.0 Pro. rtg fs/cifs/cifsencrypt.c | 40 fs/cifs/cifspdu.h |8 +++- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index fc6f4f3..4934347 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -548,7 +548,13 @@ static int CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) { int rc; - unsigned int offset = CIFS_SESS_KEY_SIZE + 8; + struct ntlmv2_resp *ntlmv2 = (struct ntlmv2_resp *) + (ses-auth_key.response + CIFS_SESS_KEY_SIZE); + unsigned int hash_len; + + /* The MD5 hash starts at challenge_key.key */ + hash_len = ses-auth_key.len - (CIFS_SESS_KEY_SIZE + + offsetof(struct ntlmv2_resp, challenge.key[0])); if (!ses-server-secmech.sdeschmacmd5) { cifs_dbg(VFS, %s: can't generate ntlmv2 hash\n, __func__); @@ -556,7 +562,7 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) } rc = crypto_shash_setkey(ses-server-secmech.hmacmd5, - ntlmv2_hash, CIFS_HMAC_MD5_HASH_SIZE); +ntlmv2_hash, CIFS_HMAC_MD5_HASH_SIZE); if (rc) { cifs_dbg(VFS, %s: Could not set NTLMV2 Hash as a key\n, __func__); @@ -570,20 +576,21 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) } if (ses-server-negflavor == CIFS_NEGFLAVOR_EXTENDED) - memcpy(ses-auth_key.response + offset, - ses-ntlmssp-cryptkey, CIFS_SERVER_CHALLENGE_SIZE); + memcpy(ntlmv2-challenge.key, + ses-ntlmssp-cryptkey, CIFS_SERVER_CHALLENGE_SIZE); else - memcpy(ses-auth_key.response + offset, - ses-server-cryptkey, CIFS_SERVER_CHALLENGE_SIZE); + memcpy(ntlmv2-challenge.key, + ses-server-cryptkey, CIFS_SERVER_CHALLENGE_SIZE); rc = crypto_shash_update(ses-server-secmech.sdeschmacmd5-shash, - ses-auth_key.response + offset, ses-auth_key.len - offset); +ntlmv2-challenge.key, hash_len); if (rc) { cifs_dbg(VFS, %s: Could not update with response\n, __func__); return rc; } + /* Note that the MD5 digest over writes anon.challenge_key.key */ rc = crypto_shash_final(ses-server-secmech.sdeschmacmd5-shash, - ses-auth_key.response + CIFS_SESS_KEY_SIZE); + ntlmv2-ntlmv2_hash); if (rc) cifs_dbg(VFS, %s: Could not generate md5 hash\n, __func__); @@ -627,7 +634,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) int rc; int baselen; unsigned int tilen; - struct ntlmv2_resp *buf; + struct ntlmv2_resp *ntlmv2; char ntlmv2_hash[16]; unsigned char *tiblob = NULL; /* target info blob */ @@ -660,13 +667,14 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) } ses-auth_key.len += baselen; - buf = (struct ntlmv2_resp *) + ntlmv2 = (struct ntlmv2_resp *) (ses-auth_key.response + CIFS_SESS_KEY_SIZE); - buf-blob_signature = cpu_to_le32(0x0101); - buf-reserved = 0; - buf-time = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); - get_random_bytes(buf-client_chal, sizeof(buf-client_chal)); - buf-reserved2 = 0; + ntlmv2-blob_signature = cpu_to_le32(0x0101); + ntlmv2-reserved = 0; + /* Must be within 5 minutes of the server */ + ntlmv2-time = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME
Re: [PATCH linux-next V2] cifs: Make big endian multiplex ID sequences monotonic on the wire
On 11/01/2013 11:50 AM, Steve French wrote: > This has a couple of obvious endian errors. I will correct your patch > and remerge into cifs-2.6.git for-next > > Please always remember to run endian checks against cifs builds when > submitting a patch (and make sure sparse is installed) > > e.g. > > make C=1 M=fs/cifs modules CF=-D__CHECK_ENDIAN__ > Didn't know about __CHECK_ENDIAN__, but will do so in the future. Your changes look fine. rtg -- Tim Gardner t...@tpi.com www.tpi.com OR 503-601-0234 x102 MT 406-443-5357 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH linux-next V2] cifs: Make big endian multiplex ID sequences monotonic on the wire
On 11/01/2013 11:50 AM, Steve French wrote: This has a couple of obvious endian errors. I will correct your patch and remerge into cifs-2.6.git for-next Please always remember to run endian checks against cifs builds when submitting a patch (and make sure sparse is installed) e.g. make C=1 M=fs/cifs modules CF=-D__CHECK_ENDIAN__ Didn't know about __CHECK_ENDIAN__, but will do so in the future. Your changes look fine. rtg -- Tim Gardner t...@tpi.com www.tpi.com OR 503-601-0234 x102 MT 406-443-5357 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.12-rc7] KVM: Fix modprobe failure for kvm_intel/kvm_amd
The x86 specific kvm init creates a new conflicting debugfs directory which causes modprobe issues with kvm_intel and kvm_amd. For example, sudo modprobe kvm_amd modprobe: ERROR: could not insert 'kvm_amd': Bad address The simplest fix is to just rename the directory. The following KVM config options are set: CONFIG_KVM_GUEST=y CONFIG_KVM_DEBUG_FS=y CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y CONFIG_HAVE_KVM_IRQ_ROUTING=y CONFIG_HAVE_KVM_EVENTFD=y CONFIG_KVM_APIC_ARCHITECTURE=y CONFIG_KVM_MMIO=y CONFIG_KVM_ASYNC_PF=y CONFIG_HAVE_KVM_MSI=y CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y CONFIG_KVM=m CONFIG_KVM_INTEL=m CONFIG_KVM_AMD=m # CONFIG_KVM_MMU_AUDIT is not set CONFIG_KVM_DEVICE_ASSIGNMENT=y Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Gleb Natapov Cc: Raghavendra K T Cc: Marcelo Tosatti Signed-off-by: Tim Gardner --- There is likely a more elegant and complicated way to solve this problem, but a simple rename for a debug feature seems best, especially for an -rc7. arch/x86/kernel/kvm.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index a0e2a8a..d17895a 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -609,7 +609,7 @@ static struct dentry *d_kvm_debug; struct dentry *kvm_init_debugfs(void) { - d_kvm_debug = debugfs_create_dir("kvm", NULL); + d_kvm_debug = debugfs_create_dir("kvm-x86", NULL); if (!d_kvm_debug) printk(KERN_WARNING "Could not create 'kvm' debugfs directory\n"); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3.12-rc7] KVM: Fix modprobe failure for kvm_intel/kvm_amd
The x86 specific kvm init creates a new conflicting debugfs directory which causes modprobe issues with kvm_intel and kvm_amd. For example, sudo modprobe kvm_amd modprobe: ERROR: could not insert 'kvm_amd': Bad address The simplest fix is to just rename the directory. The following KVM config options are set: CONFIG_KVM_GUEST=y CONFIG_KVM_DEBUG_FS=y CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y CONFIG_HAVE_KVM_IRQ_ROUTING=y CONFIG_HAVE_KVM_EVENTFD=y CONFIG_KVM_APIC_ARCHITECTURE=y CONFIG_KVM_MMIO=y CONFIG_KVM_ASYNC_PF=y CONFIG_HAVE_KVM_MSI=y CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y CONFIG_KVM=m CONFIG_KVM_INTEL=m CONFIG_KVM_AMD=m # CONFIG_KVM_MMU_AUDIT is not set CONFIG_KVM_DEVICE_ASSIGNMENT=y Cc: Thomas Gleixner t...@linutronix.de Cc: Ingo Molnar mi...@redhat.com Cc: H. Peter Anvin h...@zytor.com Cc: Gleb Natapov g...@redhat.com Cc: Raghavendra K T raghavendra...@linux.vnet.ibm.com Cc: Marcelo Tosatti mtosa...@redhat.com Signed-off-by: Tim Gardner tim.gard...@canonical.com --- There is likely a more elegant and complicated way to solve this problem, but a simple rename for a debug feature seems best, especially for an -rc7. arch/x86/kernel/kvm.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index a0e2a8a..d17895a 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -609,7 +609,7 @@ static struct dentry *d_kvm_debug; struct dentry *kvm_init_debugfs(void) { - d_kvm_debug = debugfs_create_dir(kvm, NULL); + d_kvm_debug = debugfs_create_dir(kvm-x86, NULL); if (!d_kvm_debug) printk(KERN_WARNING Could not create 'kvm' debugfs directory\n); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH linux-next] cifs: Cleanup and clarify CalcNTLMv2_response()
Use of a structure aids in the understanding of this seemingly simple bit of code. The addition of a couple of comments also helps. Cc: Jeff Layton Cc: Steve French Signed-off-by: Tim Gardner --- I'd just like to be sure that the destructive copy is really what was intended. I can't tell from reading the MSDN section 3.3.2 NTLM v2 Authentication. It sort of makes my head hurt. rtg fs/cifs/cifsencrypt.c | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index fc6f4f3..fecbfd0 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -548,7 +548,9 @@ static int CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) { int rc; - unsigned int offset = CIFS_SESS_KEY_SIZE + 8; + struct ntlmv2_resp *resp = (struct ntlmv2_resp *) + (ses->auth_key.response + CIFS_SESS_KEY_SIZE); + unsigned int hashed_len = ses->auth_key.len - (CIFS_SESS_KEY_SIZE + 8); if (!ses->server->secmech.sdeschmacmd5) { cifs_dbg(VFS, "%s: can't generate ntlmv2 hash\n", __func__); @@ -569,21 +571,30 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) return rc; } + /* +* The cryptkey is part of the buffer that feeds the MD5 hash, but +* gets over written later by the digest. See crypto_shash_final() +* below. +*/ if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) - memcpy(ses->auth_key.response + offset, + memcpy(>ntlmv2_hash[CIFS_SERVER_CHALLENGE_SIZE], ses->ntlmssp->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); else - memcpy(ses->auth_key.response + offset, + memcpy(>ntlmv2_hash[CIFS_SERVER_CHALLENGE_SIZE], ses->server->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); rc = crypto_shash_update(>server->secmech.sdeschmacmd5->shash, - ses->auth_key.response + offset, ses->auth_key.len - offset); + >ntlmv2_hash[8], hashed_len); if (rc) { cifs_dbg(VFS, "%s: Could not update with response\n", __func__); return rc; } + /* +* Yes - this is destructive. The 16 byte MD5 digest clobbers the +* cryptkey that was just copied into >ntlmv2_hash[8]. +*/ rc = crypto_shash_final(>server->secmech.sdeschmacmd5->shash, - ses->auth_key.response + CIFS_SESS_KEY_SIZE); + resp->ntlmv2_hash); if (rc) cifs_dbg(VFS, "%s: Could not generate md5 hash\n", __func__); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH linux-next] cifs: Cleanup and clarify CalcNTLMv2_response()
Use of a structure aids in the understanding of this seemingly simple bit of code. The addition of a couple of comments also helps. Cc: Jeff Layton jlay...@redhat.com Cc: Steve French sfre...@samba.org Signed-off-by: Tim Gardner t...@tpi.com --- I'd just like to be sure that the destructive copy is really what was intended. I can't tell from reading the MSDN section 3.3.2 NTLM v2 Authentication. It sort of makes my head hurt. rtg fs/cifs/cifsencrypt.c | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index fc6f4f3..fecbfd0 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -548,7 +548,9 @@ static int CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) { int rc; - unsigned int offset = CIFS_SESS_KEY_SIZE + 8; + struct ntlmv2_resp *resp = (struct ntlmv2_resp *) + (ses-auth_key.response + CIFS_SESS_KEY_SIZE); + unsigned int hashed_len = ses-auth_key.len - (CIFS_SESS_KEY_SIZE + 8); if (!ses-server-secmech.sdeschmacmd5) { cifs_dbg(VFS, %s: can't generate ntlmv2 hash\n, __func__); @@ -569,21 +571,30 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) return rc; } + /* +* The cryptkey is part of the buffer that feeds the MD5 hash, but +* gets over written later by the digest. See crypto_shash_final() +* below. +*/ if (ses-server-negflavor == CIFS_NEGFLAVOR_EXTENDED) - memcpy(ses-auth_key.response + offset, + memcpy(resp-ntlmv2_hash[CIFS_SERVER_CHALLENGE_SIZE], ses-ntlmssp-cryptkey, CIFS_SERVER_CHALLENGE_SIZE); else - memcpy(ses-auth_key.response + offset, + memcpy(resp-ntlmv2_hash[CIFS_SERVER_CHALLENGE_SIZE], ses-server-cryptkey, CIFS_SERVER_CHALLENGE_SIZE); rc = crypto_shash_update(ses-server-secmech.sdeschmacmd5-shash, - ses-auth_key.response + offset, ses-auth_key.len - offset); + resp-ntlmv2_hash[8], hashed_len); if (rc) { cifs_dbg(VFS, %s: Could not update with response\n, __func__); return rc; } + /* +* Yes - this is destructive. The 16 byte MD5 digest clobbers the +* cryptkey that was just copied into resp-ntlmv2_hash[8]. +*/ rc = crypto_shash_final(ses-server-secmech.sdeschmacmd5-shash, - ses-auth_key.response + CIFS_SESS_KEY_SIZE); + resp-ntlmv2_hash); if (rc) cifs_dbg(VFS, %s: Could not generate md5 hash\n, __func__); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/