lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5231CDFE.8050206@gmail.com>
Date:	Thu, 12 Sep 2013 22:21:50 +0800
From:	Niu Yawei <yawei.niu@...il.com>
To:	adityakali@...gle.com, tytso@....edu
CC:	linux-ext4@...r.kernel.org, yawei.niu@...el.com
Subject: [PATCH] tune2fs: update i_size in ext2fs_file_write()

ext2fs_file_write() needs to update i_size on successful write,
otherwise, ext2fs_file_read() in same open/close cycle will not
be able to read the just written data.

Which result in the the problem of quotacheck triggered on
'tune2fs -O quota' failed to write back multiple users/groups
accounting information.

Signed-off-by: Niu Yawei <yawei.niu@...el.com>
---
 lib/ext2fs/fileio.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c
index 1f7002c..b1b5540 100644
--- a/lib/ext2fs/fileio.c
+++ b/lib/ext2fs/fileio.c
@@ -304,6 +304,13 @@ errcode_t ext2fs_file_write(ext2_file_t file, const
void *buf,
 		ptr += c;
 		count += c;
 		nbytes -= c;
+
+		/* Update inode size */
+		if (EXT2_I_SIZE(&file->inode) < file->pos) {
+			retval = ext2fs_file_set_size2(file, file->pos);
+			if (retval)
+				goto fail;
+		}
 	}

 fail:
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ