From 5853c2da91be436e52fcb5115a5a56ae04b4fbba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 23 Sep 2014 21:33:17 +0200 Subject: [PATCH] openafs: fix on kernel 3.16 with upstream patches --- ...b07f827d6f3e2032a412f5f6cb3951a27d2d.patch | 51 +++++++ pkgs/servers/openafs-client/default.nix | 5 + ...f74186f4a323ffc5f125d961fe384d396cac.patch | 130 ++++++++++++++++++ 3 files changed, 186 insertions(+) create mode 100644 pkgs/servers/openafs-client/ae86b07f827d6f3e2032a412f5f6cb3951a27d2d.patch create mode 100644 pkgs/servers/openafs-client/f3c0f74186f4a323ffc5f125d961fe384d396cac.patch diff --git a/pkgs/servers/openafs-client/ae86b07f827d6f3e2032a412f5f6cb3951a27d2d.patch b/pkgs/servers/openafs-client/ae86b07f827d6f3e2032a412f5f6cb3951a27d2d.patch new file mode 100644 index 000000000000..b95cfb4c620b --- /dev/null +++ b/pkgs/servers/openafs-client/ae86b07f827d6f3e2032a412f5f6cb3951a27d2d.patch @@ -0,0 +1,51 @@ +From e284db57f94c8f97ed1c95dcd0bd9518d86c050c Mon Sep 17 00:00:00 2001 +From: Marc Dionne +Date: Wed, 18 Jun 2014 08:53:48 -0400 +Subject: [PATCH] Linux 3.16: Switch to iter_file_splice_write + +Users of generic_file_splice_write need to switch to +using iter_file_splice_write. + +Change-Id: If4801d27e030e1cb986f483cf437a2cfa7398eb3 +Reviewed-on: http://gerrit.openafs.org/11302 +Reviewed-by: Chas Williams - CONTRACTOR +Tested-by: Chas Williams - CONTRACTOR +Reviewed-by: Jeffrey Altman +Tested-by: Jeffrey Altman +--- + acinclude.m4 | 3 +++ + src/afs/LINUX/osi_vnodeops.c | 4 ++++ + 2 files changed, 7 insertions(+), 0 deletions(-) + +diff --git a/acinclude.m4 b/acinclude.m4 +index ae8f1ed..9e39d90 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -958,6 +958,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) + AC_CHECK_LINUX_FUNC([inode_setattr], + [#include ], + [inode_setattr(NULL, NULL);]) ++ AC_CHECK_LINUX_FUNC([iter_file_splice_write], ++ [#include ], ++ [iter_file_splice_write(NULL,NULL,NULL,0,0);]) + AC_CHECK_LINUX_FUNC([kernel_setsockopt], + [#include ], + [kernel_setsockopt(NULL, 0, 0, NULL, 0);]) +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index 6f4000b..2685915 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -827,7 +827,11 @@ struct file_operations afs_file_fops = { + .sendfile = generic_file_sendfile, + #endif + #if defined(STRUCT_FILE_OPERATIONS_HAS_SPLICE) ++# if defined(HAVE_LINUX_ITER_FILE_SPLICE_WRITE) ++ .splice_write = iter_file_splice_write, ++# else + .splice_write = generic_file_splice_write, ++# endif + .splice_read = generic_file_splice_read, + #endif + .release = afs_linux_release, +-- +1.7.1 diff --git a/pkgs/servers/openafs-client/default.nix b/pkgs/servers/openafs-client/default.nix index dc807330091d..4b5eb80b9741 100644 --- a/pkgs/servers/openafs-client/default.nix +++ b/pkgs/servers/openafs-client/default.nix @@ -10,6 +10,11 @@ stdenv.mkDerivation { url = http://www.openafs.org/dl/openafs/1.6.9/openafs-1.6.9-src.tar.bz2; sha256 = "1isgw7znp10w0mr3sicnjzbc12bd1gdwfqqr667w6p3syyhs6bkv"; }; + + patches = [ + ./f3c0f74186f4a323ffc5f125d961fe384d396cac.patch + ./ae86b07f827d6f3e2032a412f5f6cb3951a27d2d.patch + ]; buildInputs = [ autoconf automake flex yacc ncurses perl which ]; diff --git a/pkgs/servers/openafs-client/f3c0f74186f4a323ffc5f125d961fe384d396cac.patch b/pkgs/servers/openafs-client/f3c0f74186f4a323ffc5f125d961fe384d396cac.patch new file mode 100644 index 000000000000..e197ee4a34c8 --- /dev/null +++ b/pkgs/servers/openafs-client/f3c0f74186f4a323ffc5f125d961fe384d396cac.patch @@ -0,0 +1,130 @@ +From: Marc Dionne +Date: Wed, 18 Jun 2014 13:06:39 +0000 (-0400) +Subject: Linux 3.16: Convert to new write_iter/read_iter ops +X-Git-Tag: openafs-stable-1_6_10pre1~76 +X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=f3c0f74186f4a323ffc5f125d961fe384d396cac + +Linux 3.16: Convert to new write_iter/read_iter ops + +Change read/write operations to the new write_iter/read_iter +operations. + +Reviewed-on: http://gerrit.openafs.org/11303 +Reviewed-by: Chas Williams - CONTRACTOR +Tested-by: Chas Williams - CONTRACTOR +Reviewed-by: Jeffrey Altman +Tested-by: Jeffrey Altman +(cherry picked from commit a303bb257ed9e790d8c14644779e9508167887b6) + +Change-Id: I3f66104be067698a4724ed78537765cf26d4aa10 +Reviewed-on: http://gerrit.openafs.org/11309 +Reviewed-by: Chas Williams - CONTRACTOR +Tested-by: BuildBot +Reviewed-by: Stephan Wiesand +--- + +diff --git a/acinclude.m4 b/acinclude.m4 +index 83a1a8c..13d70db 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -836,6 +836,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) + AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h]) + AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h]) + AC_CHECK_LINUX_STRUCT([file_operations], [iterate], [fs.h]) ++ AC_CHECK_LINUX_STRUCT([file_operations], [read_iter], [fs.h]) + AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h]) + AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h]) + AC_CHECK_LINUX_STRUCT([inode_operations], [truncate], [fs.h]) +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index 441cce7..818debe 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -99,8 +99,11 @@ afs_linux_VerifyVCache(struct vcache *avc, cred_t **retcred) { + return afs_convert_code(code); + } + +-#ifdef HAVE_LINUX_GENERIC_FILE_AIO_READ +-# ifdef LINUX_HAS_NONVECTOR_AIO ++#if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) || defined(HAVE_LINUX_GENERIC_FILE_AIO_READ) ++# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) ++static ssize_t ++afs_linux_read_iter(struct kiocb *iocb, struct iov_iter *iter) ++# elif defined(LINUX_HAS_NONVECTOR_AIO) + static ssize_t + afs_linux_aio_read(struct kiocb *iocb, char __user *buf, size_t bufsize, + loff_t pos) +@@ -113,6 +116,11 @@ afs_linux_aio_read(struct kiocb *iocb, const struct iovec *buf, + struct file *fp = iocb->ki_filp; + ssize_t code = 0; + struct vcache *vcp = VTOAFS(fp->f_dentry->d_inode); ++# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) ++ loff_t pos = iocb->ki_pos; ++ unsigned long bufsize = iter->nr_segs; ++# endif ++ + + AFS_GLOCK(); + afs_Trace4(afs_iclSetp, CM_TRACE_AIOREADOP, ICL_TYPE_POINTER, vcp, +@@ -125,7 +133,11 @@ afs_linux_aio_read(struct kiocb *iocb, const struct iovec *buf, + * so we optimise by not using it */ + osi_FlushPages(vcp, NULL); /* ensure stale pages are gone */ + AFS_GUNLOCK(); ++# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) ++ code = generic_file_read_iter(iocb, iter); ++# else + code = generic_file_aio_read(iocb, buf, bufsize, pos); ++# endif + AFS_GLOCK(); + } + +@@ -170,8 +182,11 @@ afs_linux_read(struct file *fp, char *buf, size_t count, loff_t * offp) + * also take care of re-positioning the pointer if file is open in append + * mode. Call fake open/close to ensure we do writes of core dumps. + */ +-#ifdef HAVE_LINUX_GENERIC_FILE_AIO_READ +-# ifdef LINUX_HAS_NONVECTOR_AIO ++#if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) || defined(HAVE_LINUX_GENERIC_FILE_AIO_READ) ++# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) ++static ssize_t ++afs_linux_write_iter(struct kiocb *iocb, struct iov_iter *iter) ++# elif defined(LINUX_HAS_NONVECTOR_AIO) + static ssize_t + afs_linux_aio_write(struct kiocb *iocb, const char __user *buf, size_t bufsize, + loff_t pos) +@@ -184,6 +199,10 @@ afs_linux_aio_write(struct kiocb *iocb, const struct iovec *buf, + ssize_t code = 0; + struct vcache *vcp = VTOAFS(iocb->ki_filp->f_dentry->d_inode); + cred_t *credp; ++# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) ++ loff_t pos = iocb->ki_pos; ++ unsigned long bufsize = iter->nr_segs; ++# endif + + AFS_GLOCK(); + +@@ -199,7 +218,11 @@ afs_linux_aio_write(struct kiocb *iocb, const struct iovec *buf, + ReleaseWriteLock(&vcp->lock); + if (code == 0) { + AFS_GUNLOCK(); ++# if defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER) ++ code = generic_file_write_iter(iocb, iter); ++# else + code = generic_file_aio_write(iocb, buf, bufsize, pos); ++# endif + AFS_GLOCK(); + } + +@@ -788,7 +811,12 @@ struct file_operations afs_dir_fops = { + }; + + struct file_operations afs_file_fops = { +-#ifdef HAVE_LINUX_GENERIC_FILE_AIO_READ ++#ifdef STRUCT_FILE_OPERATIONS_HAS_READ_ITER ++ .read_iter = afs_linux_read_iter, ++ .write_iter = afs_linux_write_iter, ++ .read = new_sync_read, ++ .write = new_sync_write, ++#elif defined(HAVE_LINUX_GENERIC_FILE_AIO_READ) + .aio_read = afs_linux_aio_read, + .aio_write = afs_linux_aio_write, + .read = do_sync_read,