From 5855228a71ef0e8e211de1f1a85781ea2f2fc46d Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 1 Oct 2013 09:01:28 +0200 Subject: [PATCH] fix OpenVZ bug 2738: stat returns bad values for blocks of an NFS file --- Makefile | 3 ++- changelog.Debian | 6 +++++ fix-nfs-block-count.patch | 46 +++++++++++++++++++++++++++++++++++++ proxmox-ve/changelog.Debian | 2 +- 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 fix-nfs-block-count.patch diff --git a/Makefile b/Makefile index 7d377c3..37dc456 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ RELEASE=3.1 KERNEL_VER=2.6.32 -PKGREL=112 +PKGREL=113 # also include firmware of previous versrion into # the fw package: fwlist-2.6.32-PREV-pve KREL=25 @@ -169,6 +169,7 @@ ${KERNEL_SRC}/README: ${KERNEL_SRC}.org/README cd ${KERNEL_SRC}; patch -p1 <../fix-aspm-policy.patch cd ${KERNEL_SRC}; patch -p1 <../kbuild-generate-mudules-builtin.patch cd ${KERNEL_SRC}; patch -p1 <../add-tiocgdev-ioctl.patch + cd ${KERNEL_SRC}; patch -p1 <../fix-nfs-block-count.patch sed -i ${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/' touch $@ diff --git a/changelog.Debian b/changelog.Debian index 16be471..b553567 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -1,3 +1,9 @@ +pve-kernel-2.6.32 (2.6.32-113) unstable; urgency=low + + * fix OpenVZ bug 2738: stat returns bad values for blocks of an NFS file + + -- Proxmox Support Team Tue, 01 Oct 2013 09:01:06 +0200 + pve-kernel-2.6.32 (2.6.32-112) unstable; urgency=low * update to vzkernel-2.6.32-042stab081.3.src.rpm diff --git a/fix-nfs-block-count.patch b/fix-nfs-block-count.patch new file mode 100644 index 0000000..78459cf --- /dev/null +++ b/fix-nfs-block-count.patch @@ -0,0 +1,46 @@ +nfs: return inode i_bytes update to generic code in case of inactive quota + +From: Stanislav Kinsbursky + +This hack is ugly. All the quota should be redesigned and partially rewritten. + +https://bugzilla.openvz.org/show_bug.cgi?id=2738 + +Signed-off-by: Stanislav Kinsbursky +--- + fs/nfs/inode.c | 15 +++++++++++++++ + 1 files changed, 15 insertions(+), 0 deletions(-) + +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c +index c0278ba..13cb69e 100644 +--- a/fs/nfs/inode.c ++++ b/fs/nfs/inode.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -1397,6 +1398,20 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) + } else if (server->caps & NFS_CAP_NLINK) + invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR + | NFS_INO_REVAL_FORCED); ++ /* ++ * Incredibly ugly. Must be threw away with proper NFS quota ++ * reimplemetation. ++ */ ++ if (!sb_any_quota_active(inode->i_sb)) { ++ if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { ++ /* ++ * report the blocks in 512byte units ++ */ ++ inode->i_blocks = nfs_calc_block_size(inode, fattr->du.nfs3.used); ++ } ++ if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) ++ inode->i_blocks = fattr->du.nfs2.blocks; ++ } + + /* Update attrtimeo value if we're out of the unstable period */ + if (invalid & NFS_INO_INVALID_ATTR) { diff --git a/proxmox-ve/changelog.Debian b/proxmox-ve/changelog.Debian index 65b657b..eda56df 100644 --- a/proxmox-ve/changelog.Debian +++ b/proxmox-ve/changelog.Debian @@ -1,4 +1,4 @@ -proxmox-ve-2.6.32 (3.1-112) unstable; urgency=low +proxmox-ve-2.6.32 (3.1-113) unstable; urgency=low * re-package to update version number for 3.1 release -- 2.39.2