From: Greg Kroah-Hartman Date: Fri, 3 May 2013 23:02:51 +0000 (-0700) Subject: 3.4-stable patches X-Git-Tag: v3.0.77~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6657e89779f831c9185a0e5c93e79355320f7454;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: cgroup-fix-an-off-by-one-bug-which-may-trigger-bug_on.patch clockevents-set-dummy-handler-on-cpu_dead-shutdown.patch fs-dcache.c-add-cond_resched-to-shrink_dcache_parent.patch ipc-sysv-shared-memory-limited-to-8tib.patch lockd-ensure-that-nlmclnt_block-resets-block-b_status-after-a-server-reboot.patch md-bad-block-list-should-default-to-disabled.patch nfsd4-don-t-close-read-write-opens-too-soon.patch nfsd-decode-and-send-64bit-time-values.patch nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_lock_delegation_recall.patch nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_open_delegation_recall.patch wireless-regulatory-fix-channel-disabling-race-condition.patch --- diff --git a/queue-3.4/cgroup-fix-an-off-by-one-bug-which-may-trigger-bug_on.patch b/queue-3.4/cgroup-fix-an-off-by-one-bug-which-may-trigger-bug_on.patch new file mode 100644 index 00000000000..a12e41395a3 --- /dev/null +++ b/queue-3.4/cgroup-fix-an-off-by-one-bug-which-may-trigger-bug_on.patch @@ -0,0 +1,36 @@ +From 3ac1707a13a3da9cfc8f242a15b2fae6df2c5f88 Mon Sep 17 00:00:00 2001 +From: Li Zefan +Date: Tue, 12 Mar 2013 15:36:00 -0700 +Subject: cgroup: fix an off-by-one bug which may trigger BUG_ON() + +From: Li Zefan + +commit 3ac1707a13a3da9cfc8f242a15b2fae6df2c5f88 upstream. + +The 3rd parameter of flex_array_prealloc() is the number of elements, +not the index of the last element. + +The effect of the bug is, when opening cgroup.procs, a flex array will +be allocated and all elements of the array is allocated with +GFP_KERNEL flag, but the last one is GFP_ATOMIC, and if we fail to +allocate memory for it, it'll trigger a BUG_ON(). + +Signed-off-by: Li Zefan +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/cgroup.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -2020,7 +2020,7 @@ static int cgroup_attach_proc(struct cgr + if (!group) + return -ENOMEM; + /* pre-allocate to guarantee space while iterating in rcu read-side. */ +- retval = flex_array_prealloc(group, 0, group_size - 1, GFP_KERNEL); ++ retval = flex_array_prealloc(group, 0, group_size, GFP_KERNEL); + if (retval) + goto out_free_group_list; + diff --git a/queue-3.4/clockevents-set-dummy-handler-on-cpu_dead-shutdown.patch b/queue-3.4/clockevents-set-dummy-handler-on-cpu_dead-shutdown.patch new file mode 100644 index 00000000000..9982bdbb017 --- /dev/null +++ b/queue-3.4/clockevents-set-dummy-handler-on-cpu_dead-shutdown.patch @@ -0,0 +1,73 @@ +From 6f7a05d7018de222e40ca003721037a530979974 Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Thu, 25 Apr 2013 11:45:53 +0200 +Subject: clockevents: Set dummy handler on CPU_DEAD shutdown + +From: Thomas Gleixner + +commit 6f7a05d7018de222e40ca003721037a530979974 upstream. + +Vitaliy reported that a per cpu HPET timer interrupt crashes the +system during hibernation. What happens is that the per cpu HPET timer +gets shut down when the nonboot cpus are stopped. When the nonboot +cpus are onlined again the HPET code sets up the MSI interrupt which +fires before the clock event device is registered. The event handler +is still set to hrtimer_interrupt, which then crashes the machine due +to highres mode not being active. + +See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=700333 + +There is no real good way to avoid that in the HPET code. The HPET +code alrady has a mechanism to detect spurious interrupts when event +handler == NULL for a similar reason. + +We can handle that in the clockevent/tick layer and replace the +previous functional handler with a dummy handler like we do in +tick_setup_new_device(). + +The original clockevents code did this in clockevents_exchange_device(), +but that got removed by commit 7c1e76897 (clockevents: prevent +clockevent event_handler ending up handler_noop) which forgot to fix +it up in tick_shutdown(). Same issue with the broadcast device. + +Reported-by: Vitaliy Fillipov +Cc: Ben Hutchings +Cc: 700333@bugs.debian.org +Signed-off-by: Thomas Gleixner +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/time/tick-broadcast.c | 4 ++++ + kernel/time/tick-common.c | 1 + + 2 files changed, 5 insertions(+) + +--- a/kernel/time/tick-broadcast.c ++++ b/kernel/time/tick-broadcast.c +@@ -66,6 +66,8 @@ static void tick_broadcast_start_periodi + */ + int tick_check_broadcast_device(struct clock_event_device *dev) + { ++ struct clock_event_device *cur = tick_broadcast_device.evtdev; ++ + if ((dev->features & CLOCK_EVT_FEAT_DUMMY) || + (tick_broadcast_device.evtdev && + tick_broadcast_device.evtdev->rating >= dev->rating) || +@@ -73,6 +75,8 @@ int tick_check_broadcast_device(struct c + return 0; + + clockevents_exchange_device(tick_broadcast_device.evtdev, dev); ++ if (cur) ++ cur->event_handler = clockevents_handle_noop; + tick_broadcast_device.evtdev = dev; + if (!cpumask_empty(tick_get_broadcast_mask())) + tick_broadcast_start_periodic(dev); +--- a/kernel/time/tick-common.c ++++ b/kernel/time/tick-common.c +@@ -323,6 +323,7 @@ static void tick_shutdown(unsigned int * + */ + dev->mode = CLOCK_EVT_MODE_UNUSED; + clockevents_exchange_device(dev, NULL); ++ dev->event_handler = clockevents_handle_noop; + td->evtdev = NULL; + } + raw_spin_unlock_irqrestore(&tick_device_lock, flags); diff --git a/queue-3.4/fs-dcache.c-add-cond_resched-to-shrink_dcache_parent.patch b/queue-3.4/fs-dcache.c-add-cond_resched-to-shrink_dcache_parent.patch new file mode 100644 index 00000000000..be71515b987 --- /dev/null +++ b/queue-3.4/fs-dcache.c-add-cond_resched-to-shrink_dcache_parent.patch @@ -0,0 +1,112 @@ +From 421348f1ca0bf17769dee0aed4d991845ae0536d Mon Sep 17 00:00:00 2001 +From: Greg Thelen +Date: Tue, 30 Apr 2013 15:26:48 -0700 +Subject: fs/dcache.c: add cond_resched() to shrink_dcache_parent() + +From: Greg Thelen + +commit 421348f1ca0bf17769dee0aed4d991845ae0536d upstream. + +Call cond_resched() in shrink_dcache_parent() to maintain interactivity. + +Before this patch: + + void shrink_dcache_parent(struct dentry * parent) + { + while ((found = select_parent(parent, &dispose)) != 0) + shrink_dentry_list(&dispose); + } + +select_parent() populates the dispose list with dentries which +shrink_dentry_list() then deletes. select_parent() carefully uses +need_resched() to avoid doing too much work at once. But neither +shrink_dcache_parent() nor its called functions call cond_resched(). So +once need_resched() is set select_parent() will return single dentry +dispose list which is then deleted by shrink_dentry_list(). This is +inefficient when there are a lot of dentry to process. This can cause +softlockup and hurts interactivity on non preemptable kernels. + +This change adds cond_resched() in shrink_dcache_parent(). The benefit +of this is that need_resched() is quickly cleared so that future calls +to select_parent() are able to efficiently return a big batch of dentry. + +These additional cond_resched() do not seem to impact performance, at +least for the workload below. + +Here is a program which can cause soft lockup if other system activity +sets need_resched(). + + int main() + { + struct rlimit rlim; + int i; + int f[100000]; + char buf[20]; + struct timeval t1, t2; + double diff; + + /* cleanup past run */ + system("rm -rf x"); + + /* boost nfile rlimit */ + rlim.rlim_cur = 200000; + rlim.rlim_max = 200000; + if (setrlimit(RLIMIT_NOFILE, &rlim)) + err(1, "setrlimit"); + + /* make directory for files */ + if (mkdir("x", 0700)) + err(1, "mkdir"); + + if (gettimeofday(&t1, NULL)) + err(1, "gettimeofday"); + + /* populate directory with open files */ + for (i = 0; i < 100000; i++) { + snprintf(buf, sizeof(buf), "x/%d", i); + f[i] = open(buf, O_CREAT); + if (f[i] == -1) + err(1, "open"); + } + + /* close some of the files */ + for (i = 0; i < 85000; i++) + close(f[i]); + + /* unlink all files, even open ones */ + system("rm -rf x"); + + if (gettimeofday(&t2, NULL)) + err(1, "gettimeofday"); + + diff = (((double)t2.tv_sec * 1000000 + t2.tv_usec) - + ((double)t1.tv_sec * 1000000 + t1.tv_usec)); + + printf("done: %g elapsed\n", diff/1e6); + return 0; + } + +Signed-off-by: Greg Thelen +Signed-off-by: Dave Chinner +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/dcache.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/fs/dcache.c ++++ b/fs/dcache.c +@@ -1238,8 +1238,10 @@ void shrink_dcache_parent(struct dentry + LIST_HEAD(dispose); + int found; + +- while ((found = select_parent(parent, &dispose)) != 0) ++ while ((found = select_parent(parent, &dispose)) != 0) { + shrink_dentry_list(&dispose); ++ cond_resched(); ++ } + } + EXPORT_SYMBOL(shrink_dcache_parent); + diff --git a/queue-3.4/ipc-sysv-shared-memory-limited-to-8tib.patch b/queue-3.4/ipc-sysv-shared-memory-limited-to-8tib.patch new file mode 100644 index 00000000000..8c0cccd3af6 --- /dev/null +++ b/queue-3.4/ipc-sysv-shared-memory-limited-to-8tib.patch @@ -0,0 +1,60 @@ +From d69f3bad4675ac519d41ca2b11e1c00ca115cecd Mon Sep 17 00:00:00 2001 +From: Robin Holt +Date: Tue, 30 Apr 2013 19:15:54 -0700 +Subject: ipc: sysv shared memory limited to 8TiB + +From: Robin Holt + +commit d69f3bad4675ac519d41ca2b11e1c00ca115cecd upstream. + +Trying to run an application which was trying to put data into half of +memory using shmget(), we found that having a shmall value below 8EiB-8TiB +would prevent us from using anything more than 8TiB. By setting +kernel.shmall greater than 8EiB-8TiB would make the job work. + +In the newseg() function, ns->shm_tot which, at 8TiB is INT_MAX. + +ipc/shm.c: + 458 static int newseg(struct ipc_namespace *ns, struct ipc_params *params) + 459 { +... + 465 int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT; +... + 474 if (ns->shm_tot + numpages > ns->shm_ctlall) + 475 return -ENOSPC; + +[akpm@linux-foundation.org: make ipc/shm.c:newseg()'s numpages size_t, not int] +Signed-off-by: Robin Holt +Reported-by: Alex Thorlton +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/ipc_namespace.h | 2 +- + ipc/shm.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/include/linux/ipc_namespace.h ++++ b/include/linux/ipc_namespace.h +@@ -42,8 +42,8 @@ struct ipc_namespace { + + size_t shm_ctlmax; + size_t shm_ctlall; ++ unsigned long shm_tot; + int shm_ctlmni; +- int shm_tot; + /* + * Defines whether IPC_RMID is forced for _all_ shm segments regardless + * of shmctl() +--- a/ipc/shm.c ++++ b/ipc/shm.c +@@ -450,7 +450,7 @@ static int newseg(struct ipc_namespace * + size_t size = params->u.size; + int error; + struct shmid_kernel *shp; +- int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT; ++ size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; + struct file * file; + char name[13]; + int id; diff --git a/queue-3.4/lockd-ensure-that-nlmclnt_block-resets-block-b_status-after-a-server-reboot.patch b/queue-3.4/lockd-ensure-that-nlmclnt_block-resets-block-b_status-after-a-server-reboot.patch new file mode 100644 index 00000000000..15d2c7b7aa4 --- /dev/null +++ b/queue-3.4/lockd-ensure-that-nlmclnt_block-resets-block-b_status-after-a-server-reboot.patch @@ -0,0 +1,51 @@ +From 1dfd89af8697a299e7982ae740d4695ecd917eef Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Sun, 21 Apr 2013 18:01:06 -0400 +Subject: LOCKD: Ensure that nlmclnt_block resets block->b_status after a server reboot + +From: Trond Myklebust + +commit 1dfd89af8697a299e7982ae740d4695ecd917eef upstream. + +After a server reboot, the reclaimer thread will recover all the existing +locks. For locks that are blocked, however, it will change the value +of block->b_status to nlm_lck_denied_grace_period in order to signal that +they need to wake up and resend the original blocking lock request. + +Due to a bug, however, the block->b_status never gets reset after the +blocked locks have been woken up, and so the process goes into an +infinite loop of resends until the blocked lock is satisfied. + +Reported-by: Marc Eshel +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/lockd/clntlock.c | 3 +++ + fs/lockd/clntproc.c | 3 --- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/fs/lockd/clntlock.c ++++ b/fs/lockd/clntlock.c +@@ -144,6 +144,9 @@ int nlmclnt_block(struct nlm_wait *block + timeout); + if (ret < 0) + return -ERESTARTSYS; ++ /* Reset the lock status after a server reboot so we resend */ ++ if (block->b_status == nlm_lck_denied_grace_period) ++ block->b_status = nlm_lck_blocked; + req->a_res.status = block->b_status; + return 0; + } +--- a/fs/lockd/clntproc.c ++++ b/fs/lockd/clntproc.c +@@ -551,9 +551,6 @@ again: + status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT); + if (status < 0) + break; +- /* Resend the blocking lock request after a server reboot */ +- if (resp->status == nlm_lck_denied_grace_period) +- continue; + if (resp->status != nlm_lck_blocked) + break; + } diff --git a/queue-3.4/md-bad-block-list-should-default-to-disabled.patch b/queue-3.4/md-bad-block-list-should-default-to-disabled.patch new file mode 100644 index 00000000000..e6cda5be5f9 --- /dev/null +++ b/queue-3.4/md-bad-block-list-should-default-to-disabled.patch @@ -0,0 +1,61 @@ +From 486adf72ccc0c235754923d47a2270c5dcb0c98b Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Wed, 24 Apr 2013 11:42:44 +1000 +Subject: md: bad block list should default to disabled. + +From: NeilBrown + +commit 486adf72ccc0c235754923d47a2270c5dcb0c98b upstream. + +Maintenance of a bad-block-list currently defaults to 'enabled' +and is then disabled when it cannot be supported. +This is backwards and causes problem for dm-raid which didn't know +to disable it. + +So fix the defaults, and only enabled for v1.x metadata which +explicitly has bad blocks enabled. + +The problem with dm-raid has been present since badblock support was +added in v3.1, so this patch is suitable for any -stable from 3.1 +onwards. + +Reported-by: Jonathan Brassow +Signed-off-by: NeilBrown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/md.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -1587,8 +1587,8 @@ static int super_1_load(struct md_rdev * + sector, count, 1) == 0) + return -EINVAL; + } +- } else if (sb->bblog_offset == 0) +- rdev->badblocks.shift = -1; ++ } else if (sb->bblog_offset != 0) ++ rdev->badblocks.shift = 0; + + if (!refdev) { + ret = 1; +@@ -3107,7 +3107,7 @@ int md_rdev_init(struct md_rdev *rdev) + * be used - I wonder if that matters + */ + rdev->badblocks.count = 0; +- rdev->badblocks.shift = 0; ++ rdev->badblocks.shift = -1; /* disabled until explicitly enabled */ + rdev->badblocks.page = kmalloc(PAGE_SIZE, GFP_KERNEL); + seqlock_init(&rdev->badblocks.lock); + if (rdev->badblocks.page == NULL) +@@ -3179,9 +3179,6 @@ static struct md_rdev *md_import_device( + goto abort_free; + } + } +- if (super_format == -1) +- /* hot-add for 0.90, or non-persistent: so no badblocks */ +- rdev->badblocks.shift = -1; + + return rdev; + diff --git a/queue-3.4/nfsd-decode-and-send-64bit-time-values.patch b/queue-3.4/nfsd-decode-and-send-64bit-time-values.patch new file mode 100644 index 00000000000..b9d53402ccd --- /dev/null +++ b/queue-3.4/nfsd-decode-and-send-64bit-time-values.patch @@ -0,0 +1,76 @@ +From bf8d909705e9d9bac31d9b8eac6734d2b51332a7 Mon Sep 17 00:00:00 2001 +From: Bryan Schumaker +Date: Fri, 19 Apr 2013 16:09:38 -0400 +Subject: nfsd: Decode and send 64bit time values + +From: Bryan Schumaker + +commit bf8d909705e9d9bac31d9b8eac6734d2b51332a7 upstream. + +The seconds field of an nfstime4 structure is 64bit, but we are assuming +that the first 32bits are zero-filled. So if the client tries to set +atime to a value before the epoch (touch -t 196001010101), then the +server will save the wrong value on disk. + +Signed-off-by: Bryan Schumaker +Signed-off-by: J. Bruce Fields +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfsd/nfs4xdr.c | 19 +++++-------------- + 1 file changed, 5 insertions(+), 14 deletions(-) + +--- a/fs/nfsd/nfs4xdr.c ++++ b/fs/nfsd/nfs4xdr.c +@@ -343,10 +343,7 @@ nfsd4_decode_fattr(struct nfsd4_compound + all 32 bits of 'nseconds'. */ + READ_BUF(12); + len += 12; +- READ32(dummy32); +- if (dummy32) +- return nfserr_inval; +- READ32(iattr->ia_atime.tv_sec); ++ READ64(iattr->ia_atime.tv_sec); + READ32(iattr->ia_atime.tv_nsec); + if (iattr->ia_atime.tv_nsec >= (u32)1000000000) + return nfserr_inval; +@@ -369,10 +366,7 @@ nfsd4_decode_fattr(struct nfsd4_compound + all 32 bits of 'nseconds'. */ + READ_BUF(12); + len += 12; +- READ32(dummy32); +- if (dummy32) +- return nfserr_inval; +- READ32(iattr->ia_mtime.tv_sec); ++ READ64(iattr->ia_mtime.tv_sec); + READ32(iattr->ia_mtime.tv_nsec); + if (iattr->ia_mtime.tv_nsec >= (u32)1000000000) + return nfserr_inval; +@@ -2371,8 +2365,7 @@ out_acl: + if (bmval1 & FATTR4_WORD1_TIME_ACCESS) { + if ((buflen -= 12) < 0) + goto out_resource; +- WRITE32(0); +- WRITE32(stat.atime.tv_sec); ++ WRITE64((s64)stat.atime.tv_sec); + WRITE32(stat.atime.tv_nsec); + } + if (bmval1 & FATTR4_WORD1_TIME_DELTA) { +@@ -2385,15 +2378,13 @@ out_acl: + if (bmval1 & FATTR4_WORD1_TIME_METADATA) { + if ((buflen -= 12) < 0) + goto out_resource; +- WRITE32(0); +- WRITE32(stat.ctime.tv_sec); ++ WRITE64((s64)stat.ctime.tv_sec); + WRITE32(stat.ctime.tv_nsec); + } + if (bmval1 & FATTR4_WORD1_TIME_MODIFY) { + if ((buflen -= 12) < 0) + goto out_resource; +- WRITE32(0); +- WRITE32(stat.mtime.tv_sec); ++ WRITE64((s64)stat.mtime.tv_sec); + WRITE32(stat.mtime.tv_nsec); + } + if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) { diff --git a/queue-3.4/nfsd4-don-t-close-read-write-opens-too-soon.patch b/queue-3.4/nfsd4-don-t-close-read-write-opens-too-soon.patch new file mode 100644 index 00000000000..4a4f027212f --- /dev/null +++ b/queue-3.4/nfsd4-don-t-close-read-write-opens-too-soon.patch @@ -0,0 +1,40 @@ +From 0c7c3e67ab91ec6caa44bdf1fc89a48012ceb0c5 Mon Sep 17 00:00:00 2001 +From: "J. Bruce Fields" +Date: Thu, 28 Mar 2013 20:37:14 -0400 +Subject: nfsd4: don't close read-write opens too soon + +From: "J. Bruce Fields" + +commit 0c7c3e67ab91ec6caa44bdf1fc89a48012ceb0c5 upstream. + +Don't actually close any opens until we don't need them at all. + +This means being left with write access when it's not really necessary, +but that's better than putting a file that might still have posix locks +held on it, as we have been. + +Reported-by: Toralf Förster +Signed-off-by: J. Bruce Fields +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfsd/nfs4state.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -213,13 +213,7 @@ static void __nfs4_file_put_access(struc + { + if (atomic_dec_and_test(&fp->fi_access[oflag])) { + nfs4_file_put_fd(fp, oflag); +- /* +- * It's also safe to get rid of the RDWR open *if* +- * we no longer have need of the other kind of access +- * or if we already have the other kind of open: +- */ +- if (fp->fi_fds[1-oflag] +- || atomic_read(&fp->fi_access[1 - oflag]) == 0) ++ if (atomic_read(&fp->fi_access[1 - oflag]) == 0) + nfs4_file_put_fd(fp, O_RDWR); + } + } diff --git a/queue-3.4/nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_lock_delegation_recall.patch b/queue-3.4/nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_lock_delegation_recall.patch new file mode 100644 index 00000000000..93ace4c481b --- /dev/null +++ b/queue-3.4/nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_lock_delegation_recall.patch @@ -0,0 +1,36 @@ +From dbb21c25a35a71baf413f5176f028ee11b88cfbc Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Mon, 1 Apr 2013 14:27:29 -0400 +Subject: NFSv4: Handle NFS4ERR_DELAY and NFS4ERR_GRACE in nfs4_lock_delegation_recall + +From: Trond Myklebust + +commit dbb21c25a35a71baf413f5176f028ee11b88cfbc upstream. + +A server shouldn't normally return NFS4ERR_GRACE if the client holds a +delegation, since no conflicting lock reclaims can be granted, however +the spec does not require the server to grant the lock in this +instance. + +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/nfs4proc.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -4874,6 +4874,12 @@ int nfs4_lock_delegation_recall(struct n + */ + err = 0; + goto out; ++ case -NFS4ERR_DELAY: ++ case -NFS4ERR_GRACE: ++ set_bit(NFS_DELEGATED_STATE, &state->flags); ++ ssleep(1); ++ err = -EAGAIN; ++ goto out; + case -ENOMEM: + case -NFS4ERR_DENIED: + /* kill_proc(fl->fl_pid, SIGLOST, 1); */ diff --git a/queue-3.4/nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_open_delegation_recall.patch b/queue-3.4/nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_open_delegation_recall.patch new file mode 100644 index 00000000000..69f9df16b2b --- /dev/null +++ b/queue-3.4/nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_open_delegation_recall.patch @@ -0,0 +1,36 @@ +From 8b6cc4d6f841d31f72fe7478453759166d366274 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Mon, 1 Apr 2013 15:34:05 -0400 +Subject: NFSv4: Handle NFS4ERR_DELAY and NFS4ERR_GRACE in nfs4_open_delegation_recall + +From: Trond Myklebust + +commit 8b6cc4d6f841d31f72fe7478453759166d366274 upstream. + +A server shouldn't normally return NFS4ERR_GRACE if the client holds a +delegation, since no conflicting lock reclaims can be granted, however +the spec does not require the server to grant the open in this +instance + +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/nfs4proc.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -1362,6 +1362,12 @@ int nfs4_open_delegation_recall(struct n + case -ENOMEM: + err = 0; + goto out; ++ case -NFS4ERR_DELAY: ++ case -NFS4ERR_GRACE: ++ set_bit(NFS_DELEGATED_STATE, &state->flags); ++ ssleep(1); ++ err = -EAGAIN; ++ goto out; + } + err = nfs4_handle_exception(server, err, &exception); + } while (exception.retry); diff --git a/queue-3.4/series b/queue-3.4/series index 77d867881e8..3617d42ad49 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -40,3 +40,14 @@ asoc-max98088-fix-logging-of-hardware-revision.patch hrtimer-fix-ktime_add_ns-overflow-on-32bit-architectures.patch hrtimer-add-expiry-time-overflow-check-in-hrtimer_interrupt.patch drivers-rtc-rtc-cmos.c-don-t-disable-hpet-emulation-on-suspend.patch +cgroup-fix-an-off-by-one-bug-which-may-trigger-bug_on.patch +clockevents-set-dummy-handler-on-cpu_dead-shutdown.patch +fs-dcache.c-add-cond_resched-to-shrink_dcache_parent.patch +lockd-ensure-that-nlmclnt_block-resets-block-b_status-after-a-server-reboot.patch +md-bad-block-list-should-default-to-disabled.patch +nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_lock_delegation_recall.patch +nfsv4-handle-nfs4err_delay-and-nfs4err_grace-in-nfs4_open_delegation_recall.patch +nfsd4-don-t-close-read-write-opens-too-soon.patch +nfsd-decode-and-send-64bit-time-values.patch +wireless-regulatory-fix-channel-disabling-race-condition.patch +ipc-sysv-shared-memory-limited-to-8tib.patch diff --git a/queue-3.4/wireless-regulatory-fix-channel-disabling-race-condition.patch b/queue-3.4/wireless-regulatory-fix-channel-disabling-race-condition.patch new file mode 100644 index 00000000000..b61008f74b8 --- /dev/null +++ b/queue-3.4/wireless-regulatory-fix-channel-disabling-race-condition.patch @@ -0,0 +1,39 @@ +From 990de49f74e772b6db5208457b7aa712a5f4db86 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Tue, 16 Apr 2013 14:32:26 +0200 +Subject: wireless: regulatory: fix channel disabling race condition + +From: Johannes Berg + +commit 990de49f74e772b6db5208457b7aa712a5f4db86 upstream. + +When a full scan 2.4 and 5 GHz scan is scheduled, but then the 2.4 GHz +part of the scan disables a 5.2 GHz channel due to, e.g. receiving +country or frequency information, that 5.2 GHz channel might already +be in the list of channels to scan next. Then, when the driver checks +if it should do a passive scan, that will return false and attempt an +active scan. This is not only wrong but can also lead to the iwlwifi +device firmware crashing since it checks regulatory as well. + +Fix this by not setting the channel flags to just disabled but rather +OR'ing in the disabled flag. That way, even if the race happens, the +channel will be scanned passively which is still (mostly) correct. + +Signed-off-by: Johannes Berg +Signed-off-by: Greg Kroah-Hartman + +--- + net/wireless/reg.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -862,7 +862,7 @@ static void handle_channel(struct wiphy + return; + + REG_DBG_PRINT("Disabling freq %d MHz\n", chan->center_freq); +- chan->flags = IEEE80211_CHAN_DISABLED; ++ chan->flags |= IEEE80211_CHAN_DISABLED; + return; + } +