[RFC] [patch 3/3] i_version update for ext4: user interface

2007-01-23 Thread Cordenner jean noel

This patch adds a  ``st_i_version'' field in the stat
structure, and modifies the stat(2) syscall accordingly. Currently the
change is only visible on i386 and x86_64 archs.



Signed-off-by: Jean Noel Cordenner [EMAIL PROTECTED]

Index: linux-2.6.20-rc5/fs/stat.c
===
--- linux-2.6.20-rc5.orig/fs/stat.c 2007-01-19 16:59:15.0 +0100
+++ linux-2.6.20-rc5/fs/stat.c  2007-01-23 16:21:17.0 +0100
@@ -31,6 +31,7 @@
stat-atime = inode-i_atime;
stat-mtime = inode-i_mtime;
stat-ctime = inode-i_ctime;
+   stat-i_version = inode-i_version;
stat-size = i_size_read(inode);
stat-blocks = inode-i_blocks;
stat-blksize = (1  inode-i_blkbits);
@@ -226,6 +227,7 @@
tmp.st_atime = stat-atime.tv_sec;
tmp.st_mtime = stat-mtime.tv_sec;
tmp.st_ctime = stat-ctime.tv_sec;
+   tmp.st_i_version = stat-i_version;
 #ifdef STAT_HAVE_NSEC
tmp.st_atime_nsec = stat-atime.tv_nsec;
tmp.st_mtime_nsec = stat-mtime.tv_nsec;
@@ -359,6 +361,7 @@
tmp.st_mtime_nsec = stat-mtime.tv_nsec;
tmp.st_ctime = stat-ctime.tv_sec;
tmp.st_ctime_nsec = stat-ctime.tv_nsec;
+   tmp.st_i_version = stat-i_version;
tmp.st_size = stat-size;
tmp.st_blocks = stat-blocks;
tmp.st_blksize = stat-blksize;
Index: linux-2.6.20-rc5/include/linux/stat.h
===
--- linux-2.6.20-rc5.orig/include/linux/stat.h  2006-11-29 
22:57:37.0 +0100
+++ linux-2.6.20-rc5/include/linux/stat.h   2007-01-23 
16:22:18.0 +0100

@@ -68,6 +68,7 @@
struct timespec  atime;
struct timespec mtime;
struct timespec ctime;
+   unsigned long   i_version;
unsigned long   blksize;
unsigned long long  blocks;
 };
Index: linux-2.6.20-rc5/include/asm-i386/stat.h
===
--- linux-2.6.20-rc5.orig/include/asm-i386/stat.h   2006-11-29 
22:57:37.0 +0100
+++ linux-2.6.20-rc5/include/asm-i386/stat.h2007-01-23 
17:48:36.0 +0100

@@ -32,7 +32,7 @@
unsigned long  st_mtime_nsec;
unsigned long  st_ctime;
unsigned long  st_ctime_nsec;
-   unsigned long  __unused4;
+   unsigned long  st_i_version;
unsigned long  __unused5;
 };

@@ -41,7 +41,7 @@
  */
 struct stat64 {
unsigned long long  st_dev;
-   unsigned char   __pad0[4];
+   unsigned intst_i_version;

 #define STAT64_HAS_BROKEN_ST_INO   1
unsigned long   __st_ino;
Index: linux-2.6.20-rc5/include/asm-x86_64/stat.h
===
--- linux-2.6.20-rc5.orig/include/asm-x86_64/stat.h 2006-11-29 
22:57:37.0 +0100
+++ linux-2.6.20-rc5/include/asm-x86_64/stat.h  2007-01-23 
17:57:03.0 +0100

@@ -23,7 +23,8 @@
unsigned long   st_mtime_nsec;
unsigned long   st_ctime;
unsigned long   st_ctime_nsec;
-   long__unused[3];
+   unsigned long   st_i_version;
+   long__unused[2];
 };

 /* For 32bit emulation */

-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] [patch 0/3] i_version update for ext4

2007-01-23 Thread Andreas Dilger
On Jan 23, 2007  18:23 +0100, Cordenner jean noel wrote:
 I've updated what was previously the change attribute patch for ext4 
 initially posted by Alexandre Ratchov. The previous patch was 
 introducing a change_attribute field, now it uses the i_version field of 
 the inode.
 
 The i_version field is a counter that is set on every inode creation and 
 that is incremented every time the inode data is modified (similarly to 
 the ctime time-stamp).
 The aim is to fulfill NFSv4 requirements for rfc3530.
 For the moent, the counter is only a 32bit value but it is planned to be 
 64bit as required.
 
 The patch is divided into 3 parts, the vfs layer, the ext4 specific code 
 and an user part to check i_version changes via stat.

Have you had a chance to look at the performance impact of this change
(possible with oprofile)?  Always marking the inodes dirty for ext3
may have some noticable overhead.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] [patch 3/3] i_version update for ext4: user interface

2007-01-23 Thread Andreas Dilger
On Jan 23, 2007  18:24 +0100, Cordenner jean noel wrote:
 This patch adds a  ``st_i_version'' field in the stat
 structure, and modifies the stat(2) syscall accordingly. Currently the
 change is only visible on i386 and x86_64 archs.

What is the need for exporting i_version to userspace?

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [RESEND] return ENOENT from ext3_link when racing with unlink

2007-01-23 Thread Eric Sandeen
(resend now that LCA is done)

An update from the earlier thread, 
[PATCH] [RFC] remove ext3 inode from orphan list when link and unlink race

I think this is better than the original idea of trying to handle the race;
I've seen that the orphan inode list can get corrupted, but there may well
be other implications of the race which haven't yet been exposed.  I think
it's safer to simply return -ENOENT in this race window, and avoid other
potential problems.  Anything wrong with this?

Thanks for the comments suggesting this approach in the prior thread.

Thanks,

-Eric

---

Return -ENOENT from ext[34]_link if we've raced with unlink and
i_nlink is 0.  Doing otherwise has the potential to corrupt the
orphan inode list, because we'd wind up with an inode with a
non-zero link count on the list, and it will never get properly
cleaned up  removed from the orphan list before it is freed.

Signed-off-by: Eric Sandeen [EMAIL PROTECTED]

Index: linux-2.6.19/fs/ext3/namei.c
===
--- linux-2.6.19.orig/fs/ext3/namei.c
+++ linux-2.6.19/fs/ext3/namei.c
@@ -2191,6 +2191,8 @@ static int ext3_link (struct dentry * ol
 
if (inode-i_nlink = EXT3_LINK_MAX)
return -EMLINK;
+   if (inode-i_nlink == 0)
+   return -ENOENT;
 
 retry:
handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir-i_sb) +
Index: linux-2.6.19/fs/ext4/namei.c
===
--- linux-2.6.19.orig/fs/ext4/namei.c
+++ linux-2.6.19/fs/ext4/namei.c
@@ -2189,6 +2189,8 @@ static int ext4_link (struct dentry * ol
 
if (inode-i_nlink = EXT4_LINK_MAX)
return -EMLINK;
+   if (inode-i_nlink == 0)
+   return -ENOENT;
 
 retry:
handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir-i_sb) +

-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


+ fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls.patch added to -mm tree

2007-01-23 Thread akpm

The patch titled
 fix umask when noACL kernel meets extN tuned for ACLs
has been added to the -mm tree.  Its filename is
 fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

--
Subject: fix umask when noACL kernel meets extN tuned for ACLs
From: Hugh Dickins [EMAIL PROTECTED]

Fix insecure default behaviour reported by Tigran Aivazian: if an ext2 or
ext3 or ext4 filesystem is tuned to mount with acl, but mounted by a
kernel built without ACL support, then umask was ignored when creating
inodes - though root or user has umask 022, touch creates files as 0666,
and mkdir creates directories as 0777.

This appears to have worked right until 2.6.11, when a fix to the default
mode on symlinks (always 0777) assumed VFS applies umask: which it does,
unless the mount is marked for ACLs; but ext[234] set MS_POSIXACL in
s_flags according to s_mount_opt set according to def_mount_opts.

We could revert to the 2.6.10 ext[234]_init_acl (adding an S_ISLNK test);
but other filesystems only set MS_POSIXACL when ACLs are configured.  We
could fix this at another level; but it seems most robust to avoid setting
the s_mount_opt flag in the first place (at the expense of more ifdefs).

Likewise don't set the XATTR_USER flag when built without XATTR support.

Signed-off-by: Hugh Dickins [EMAIL PROTECTED]
Cc: Tigran Aivazian [EMAIL PROTECTED]
Cc: linux-ext4@vger.kernel.org
Cc: Andreas Gruenbacher [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 fs/ext2/super.c |4 
 fs/ext3/super.c |4 
 fs/ext4/super.c |4 
 3 files changed, 12 insertions(+)

diff -puN fs/ext2/super.c~fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls 
fs/ext2/super.c
--- a/fs/ext2/super.c~fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls
+++ a/fs/ext2/super.c
@@ -708,10 +708,14 @@ static int ext2_fill_super(struct super_
set_opt(sbi-s_mount_opt, GRPID);
if (def_mount_opts  EXT2_DEFM_UID16)
set_opt(sbi-s_mount_opt, NO_UID32);
+#ifdef CONFIG_EXT2_FS_XATTR
if (def_mount_opts  EXT2_DEFM_XATTR_USER)
set_opt(sbi-s_mount_opt, XATTR_USER);
+#endif
+#ifdef CONFIG_EXT2_FS_POSIX_ACL
if (def_mount_opts  EXT2_DEFM_ACL)
set_opt(sbi-s_mount_opt, POSIX_ACL);
+#endif

if (le16_to_cpu(sbi-s_es-s_errors) == EXT2_ERRORS_PANIC)
set_opt(sbi-s_mount_opt, ERRORS_PANIC);
diff -puN fs/ext3/super.c~fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls 
fs/ext3/super.c
--- a/fs/ext3/super.c~fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls
+++ a/fs/ext3/super.c
@@ -1459,10 +1459,14 @@ static int ext3_fill_super (struct super
set_opt(sbi-s_mount_opt, GRPID);
if (def_mount_opts  EXT3_DEFM_UID16)
set_opt(sbi-s_mount_opt, NO_UID32);
+#ifdef CONFIG_EXT3_FS_XATTR
if (def_mount_opts  EXT3_DEFM_XATTR_USER)
set_opt(sbi-s_mount_opt, XATTR_USER);
+#endif
+#ifdef CONFIG_EXT3_FS_POSIX_ACL
if (def_mount_opts  EXT3_DEFM_ACL)
set_opt(sbi-s_mount_opt, POSIX_ACL);
+#endif
if ((def_mount_opts  EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_DATA)
sbi-s_mount_opt |= EXT3_MOUNT_JOURNAL_DATA;
else if ((def_mount_opts  EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_ORDERED)
diff -puN fs/ext4/super.c~fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls 
fs/ext4/super.c
--- a/fs/ext4/super.c~fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls
+++ a/fs/ext4/super.c
@@ -1518,10 +1518,14 @@ static int ext4_fill_super (struct super
set_opt(sbi-s_mount_opt, GRPID);
if (def_mount_opts  EXT4_DEFM_UID16)
set_opt(sbi-s_mount_opt, NO_UID32);
+#ifdef CONFIG_EXT4DEV_FS_XATTR
if (def_mount_opts  EXT4_DEFM_XATTR_USER)
set_opt(sbi-s_mount_opt, XATTR_USER);
+#endif
+#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
if (def_mount_opts  EXT4_DEFM_ACL)
set_opt(sbi-s_mount_opt, POSIX_ACL);
+#endif
if ((def_mount_opts  EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)
sbi-s_mount_opt |= EXT4_MOUNT_JOURNAL_DATA;
else if ((def_mount_opts  EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)
_

Patches currently in -mm which might be from [EMAIL PROTECTED] are

origin.patch
slab-cache_grow-cleanup.patch
fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls.patch
ext2-reservations.patch
ext2-balloc-fix-_with_rsv-freeze.patch
ext2-balloc-reset-windowsz-when-full.patch
ext2-balloc-fix-off-by-one-against-rsv_end.patch
ext2-balloc-fix-off-by-one-against-grp_goal.patch
ext2-balloc-say-rb_entry-not-list_entry.patch
ext2-balloc-use-io_error-label.patch

-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a 

+ return-enoent-from-ext3_link-when-racing-with-unlink-fix.patch added to -mm tree

2007-01-23 Thread akpm

The patch titled
 return-enoent-from-ext3_link-when-racing-with-unlink-fix
has been added to the -mm tree.  Its filename is
 return-enoent-from-ext3_link-when-racing-with-unlink-fix.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

--
Subject: return-enoent-from-ext3_link-when-racing-with-unlink-fix
From: Andrew Morton [EMAIL PROTECTED]

sigh.

Cc: Eric Sandeen [EMAIL PROTECTED]
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 fs/ext3/namei.c |4 
 fs/ext4/namei.c |4 
 2 files changed, 8 insertions(+)

diff -puN 
fs/ext3/namei.c~return-enoent-from-ext3_link-when-racing-with-unlink-fix 
fs/ext3/namei.c
--- a/fs/ext3/namei.c~return-enoent-from-ext3_link-when-racing-with-unlink-fix
+++ a/fs/ext3/namei.c
@@ -2191,6 +2191,10 @@ static int ext3_link (struct dentry * ol
 
if (inode-i_nlink = EXT3_LINK_MAX)
return -EMLINK;
+   /*
+* Return -ENOENT if we've raced with unlink and i_nlink is 0.  Doing
+* otherwise has the potential to corrupt the orphan inode list.
+*/
if (inode-i_nlink == 0)
return -ENOENT;
 
diff -puN 
fs/ext4/namei.c~return-enoent-from-ext3_link-when-racing-with-unlink-fix 
fs/ext4/namei.c
--- a/fs/ext4/namei.c~return-enoent-from-ext3_link-when-racing-with-unlink-fix
+++ a/fs/ext4/namei.c
@@ -2189,6 +2189,10 @@ static int ext4_link (struct dentry * ol
 
if (inode-i_nlink = EXT4_LINK_MAX)
return -EMLINK;
+   /*
+* Return -ENOENT if we've raced with unlink and i_nlink is 0.  Doing
+* otherwise has the potential to corrupt the orphan inode list.
+*/
if (inode-i_nlink == 0)
return -ENOENT;
 
_

Patches currently in -mm which might be from [EMAIL PROTECTED] are

origin.patch
kvm-add-vm-exit-profiling-fix.patch
blockdev-direct_io-fix-signedness-bug.patch
submitchecklist-update.patch
i386-vdso-use-vm_alwaysdump-tidy.patch
use-correct-macros-in-raid-code-not-raw-asm-include.patch
macintosh-mangle-caps-lock-events-on-adb-keyboards.patch
git-acpi.patch
exit-acpi-processor-module-gracefully-if-acpi-is-disabled-tidy.patch
sony_apci-resume.patch
sony_apci-resume-fix.patch
video-sysfs-support-take-2-add-dev-argument-for-backlight_device_register-sony_acpi-fix.patch
git-alsa.patch
agpgart-allow-drm-populated-agp-memory-types-tidy.patch
git-cifs.patch
rewrite-lock-in-cpufreq-to-eliminate-cpufreq-hotplug-related-issues-fix-2.patch
fix-gregkh-driver-driver-core-fix-race-in-sysfs-between-sysfs_remove_file-and-read-write.patch
git-dvb.patch
git-gfs2-nmw.patch
git-hid-fixup.patch
ia64-enable-config_debug_spinlock_sleep.patch
git-ieee1394.patch
git-input.patch
git-libata-all.patch
git-lxdialog-fixup.patch
git-mmc.patch
git-mmc-fixup.patch
git-ubi.patch
git-netdev-all.patch
git-e1000-fixup.patch
update-smc91x-driver-with-arm-versatile-board-info.patch
drivers-net-ns83820c-add-paramter-to-disable-auto.patch
net-use-bitrev8.patch
bonding-replace-kmalloc-memset-pairs-with-the-appropriate-kzalloc-calls-fix.patch
net-uninline-skb_put.patch
ioat-warning-fix.patch
r8169-warning-fixes.patch
drivers-scsi-mca_53c9xc-save_flags-cli-removal.patch
scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver.patch
git-block-fixup.patch
git-block-atomicity-fix.patch
nokia-e70-is-an-unusual-device.patch
spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix.patch
spin_lock_irq-enable-interrupts-while-spinning-i386-implementation-fix-fix.patch
touchkit-ps-2-touchscreen-driver.patch
lumpy-reclaim-v2-page_to_pfn-fix.patch
lumpy-reclaim-v2-tidy.patch
avoid-excessive-sorting-of-early_node_map-tidy.patch
proc-zoneinfo-fix-vm-stats-display.patch
swsusp-change-code-ordering-in-userc-sanity.patch
deprecate-smbfs-in-favour-of-cifs.patch
drivers-add-lcd-support-3-Kconfig-fix.patch
drivers-add-lcd-support-workqueue-fixups.patch
ecryptfs-public-key-packet-management-slab-fix.patch
add-retain_initrd-boot-option-tweak.patch
count_vm_events-warning-fix.patch
procfs-fix-race-between-proc_readdir-and-remove_proc_entry-fix.patch
consolidate-line-discipline-number-definitions-v2-sparc-fix.patch
consolidate-line-discipline-number-definitions-v2-fix-2.patch
spi-controller-driver-for-omap-microwire-tidy.patch
spi-controller-driver-for-omap-microwire-update-fix.patch
add-taint_user-and-ability-to-set-taint-flags-from-userspace-fix-2.patch
remove-invalidate_inode_pages.patch
add-an-rcu-version-of-list-splicing-fix.patch
factor-outstanding-i-o-error-handling-tidy.patch
sync_sb_inodes-propagate-errors.patch
block_write_full_page-handle-enospc.patch
sysctl-warning-fix.patch
proc_misc-warning-fix.patch
return-enoent-from-ext3_link-when-racing-with-unlink-fix.patch
vmi-versus-hrtimers.patch
gtod-persistent-clock-support-i386.patch