rpms/kernel/F-11 linux-2.6-nfsd-report-short-writes-fix.patch, NONE, 1.1 linux-2.6-x86-delay-tsc-barrier.patch, NONE, 1.1 kernel.spec, 1.1668, 1.1669

Chuck Ebbert cebbert at fedoraproject.org
Tue Jun 30 19:02:38 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24392

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-nfsd-report-short-writes-fix.patch 
	linux-2.6-x86-delay-tsc-barrier.patch 
Log Message:
Fix stalled NFS writes (#508174)
Fix broken TSC-based delay.

linux-2.6-nfsd-report-short-writes-fix.patch:

--- NEW FILE linux-2.6-nfsd-report-short-writes-fix.patch ---
From: Wei Yongjun <yjwei at cn.fujitsu.com>
Date: Tue, 19 May 2009 04:03:15 +0000 (+0800)
Subject: nfsd: fix hung up of nfs client while sync write data to nfs server
X-Git-Tag: v2.6.30-rc8~20^2~2
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=a0d24b295aed7a9daf4ca36bd4784e4d40f82303

nfsd: fix hung up of nfs client while sync write data to nfs server

Commit 'Short write in nfsd becomes a full write to the client'
(31dec2538e45e9fff2007ea1f4c6bae9f78db724) broken the sync write.
With the following commands to reproduce:

  $ mount -t nfs -o sync 192.168.0.21:/nfsroot /mnt
  $ cd /mnt
  $ echo aaaa > temp.txt

Then nfs client is hung up.

In SYNC mode the server alaways return the write count 0 to the
client. This is because the value of host_err in nfsd_vfs_write()
will be overwrite in SYNC mode by 'host_err=nfsd_sync(file);',
and then we return host_err(which is now 0) as write count.

This patch fixed the problem.

Signed-off-by: Wei Yongjun <yjwei at cn.fujitsu.com>
Signed-off-by: J. Bruce Fields <bfields at citi.umich.edu>
---

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 6c68ffd..b660435 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1015,6 +1015,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
 	host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset);
 	set_fs(oldfs);
 	if (host_err >= 0) {
+		*cnt = host_err;
 		nfsdstats.io_write += host_err;
 		fsnotify_modify(file->f_path.dentry);
 	}
@@ -1060,10 +1061,9 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
 	}
 
 	dprintk("nfsd: write complete host_err=%d\n", host_err);
-	if (host_err >= 0) {
+	if (host_err >= 0)
 		err = 0;
-		*cnt = host_err;
-	} else
+	else
 		err = nfserrno(host_err);
 out:
 	return err;

linux-2.6-x86-delay-tsc-barrier.patch:

--- NEW FILE linux-2.6-x86-delay-tsc-barrier.patch ---
From: Pallipadi, Venkatesh <venkatesh.pallipadi at intel.com>
Date: Thu, 25 Jun 2009 23:44:31 +0000 (-0700)
Subject: x86, delay: tsc based udelay should have rdtsc_barrier
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=e888d7facd1f1460a638151036d15b6cfb3ccc74

x86, delay: tsc based udelay should have rdtsc_barrier

delay_tsc needs rdtsc_barrier to provide proper delay.

Output from a test driver using hpet to cross check delay
provided by udelay().

Before:
[   86.794363] Expected delay 5us actual 4679ns
[   87.154362] Expected delay 5us actual 698ns
[   87.514162] Expected delay 5us actual 4539ns
[   88.653716] Expected delay 5us actual 4539ns
[   94.664106] Expected delay 10us actual 9638ns
[   95.049351] Expected delay 10us actual 10126ns
[   95.416110] Expected delay 10us actual 9568ns
[   95.799216] Expected delay 10us actual 9638ns
[  103.624104] Expected delay 10us actual 9707ns
[  104.020619] Expected delay 10us actual 768ns
[  104.419951] Expected delay 10us actual 9707ns

After:
[   50.983320] Expected delay 5us actual 5587ns
[   51.261807] Expected delay 5us actual 5587ns
[   51.565715] Expected delay 5us actual 5657ns
[   51.861171] Expected delay 5us actual 5587ns
[   52.164704] Expected delay 5us actual 5726ns
[   52.487457] Expected delay 5us actual 5657ns
[   52.789338] Expected delay 5us actual 5726ns
[   57.119680] Expected delay 10us actual 10755ns
[   57.893997] Expected delay 10us actual 10615ns
[   58.261287] Expected delay 10us actual 10755ns
[   58.620505] Expected delay 10us actual 10825ns
[   58.941035] Expected delay 10us actual 10755ns
[   59.320903] Expected delay 10us actual 10615ns
[   61.306311] Expected delay 10us actual 10755ns
[   61.520542] Expected delay 10us actual 10615ns

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi at intel.com>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---

diff --git a/arch/x86/lib/delay.c b/arch/x86/lib/delay.c
index f456860..ff485d3 100644
--- a/arch/x86/lib/delay.c
+++ b/arch/x86/lib/delay.c
@@ -55,8 +55,10 @@ static void delay_tsc(unsigned long loops)
 
 	preempt_disable();
 	cpu = smp_processor_id();
+	rdtsc_barrier();
 	rdtscl(bclock);
 	for (;;) {
+		rdtsc_barrier();
 		rdtscl(now);
 		if ((now - bclock) >= loops)
 			break;
@@ -78,6 +80,7 @@ static void delay_tsc(unsigned long loops)
 		if (unlikely(cpu != smp_processor_id())) {
 			loops -= (now - bclock);
 			cpu = smp_processor_id();
+			rdtsc_barrier();
 			rdtscl(bclock);
 		}
 	}


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1668
retrieving revision 1.1669
diff -u -p -r1.1668 -r1.1669
--- kernel.spec	30 Jun 2009 04:59:08 -0000	1.1668
+++ kernel.spec	30 Jun 2009 19:02:07 -0000	1.1669
@@ -767,6 +767,7 @@ Patch6100: linux-2.6-fs-cifs-fix-port-nu
 
 Patch9001: revert-fix-modules_install-via-nfs.patch
 Patch9010: linux-2.6-nfsd-report-short-writes.patch
+Patch9020: linux-2.6-nfsd-report-short-writes-fix.patch
 
 Patch9100: cpufreq-add-atom-to-p4-clockmod.patch
 # VIA processors: enable pstates
@@ -784,6 +785,7 @@ Patch9307: linux-2.6.29-xen-disable-gbpa
 Patch11000: linux-2.6-parport-quickfix-the-proc-registration-bug.patch
 Patch11010: linux-2.6-dev-zero-avoid-oom-lockup.patch
 Patch11020: linux-2.6-usb-remove-low-latency-hack.patch
+Patch11030: linux-2.6-x86-delay-tsc-barrier.patch
 
 # via: enable 64-bit padlock support on nano, add CPU temp sensor,
 #  add via-sdmmc driver
@@ -1466,8 +1468,12 @@ ApplyPatch linux-2.6-dropwatch-protocol.
 
 # patches headed for -stable
 ApplyPatch squashfs-broken-when-pagesize-greater-than-blocksize.patch
+
 # fix nfs reporting of short writes (#493500)
 ApplyPatch linux-2.6-nfsd-report-short-writes.patch
+# fix the short write fix (#508174)
+ApplyPatch linux-2.6-nfsd-report-short-writes-fix.patch
+
 # fix cifs mount option "port=" (#506574)
 ApplyPatch linux-2.6-fs-cifs-fix-port-numbers.patch
 
@@ -1486,6 +1492,8 @@ ApplyPatch linux-2.6-dev-zero-avoid-oom-
 # fix oopses in usb serial devices (#500954)
 ApplyPatch linux-2.6-usb-remove-low-latency-hack.patch
 
+ApplyPatch linux-2.6-x86-delay-tsc-barrier.patch
+
 # VIA: add 64-bit padlock support, sdmmc driver, temp sensor driver
 ApplyPatch via-centaur-merge-32-64-bit-init.patch
 ApplyPatch via-padlock-fix-might-sleep.patch
@@ -2083,6 +2091,10 @@ fi
 # and build.
 
 %changelog
+* Tue Jun 30 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29.5-207
+- Fix stalled NFS writes (#508174)
+- Fix broken TSC-based delay.
+
 * Tue Jun 30 2009 Jarod Wilson <jarod at redhat.com> 2.6.29.5-206
 - Fix busticated lirc_serial (#504402)
 




More information about the fedora-extras-commits mailing list