Skip to contentSkip to conversation

+ dhowells-broke-unionfs.patch added to -mm tree

PATCH In review [email protected] 4 participants 8 messages Nov 6, 2007 – Nov 7, 2007

lore
Share & tools
lore

[email protected]

author tree notice
#0 lore raw

The patch titled
dhowells-broke-unionfs
has been added to the -mm tree. Its filename is
dhowells-broke-unionfs.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: dhowells-broke-unionfs
From: Andrew Morton <[email protected]>

fs/unionfs/main.c: In function 'unionfs_interpose':
fs/unionfs/main.c:131: error: implicit declaration of function 'iget' fs/unionfs/main.c:131: warning: assignment makes pointer from integer without a cast

please send a fix against next -mm.

Cc David Howells <[email protected]>
Cc Erez Zadok <[email protected]>

---

 fs/Kconfig |    1 +
 1 file changed, 1 insertion(+)
fs/Kconfig renamed from fs/Kconfig~dhowells-broke-unionfs +1 -0
diff -puN fs/Kconfig~dhowells-broke-unionfs fs/Kconfig
@@ -1019,6 +1019,7 @@ config ECRYPT_FS
 config UNION_FS
 	tristate "Union file system (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
+	depends on BROKEN
 	help
 	  Unionfs is a stackable unification file system, which appears to
 	  merge the contents of several directories (branches), while keeping

_

Patches currently in -mm which might be from [email protected] are

origin.patch proc-fix-proc_kill_inodes-to-kill-dentries-on-all-proc-superblocks-checkpatch-fixes.patch acpi-enable-c3-power-state-on-dell-inspiron-8200-fix.patch
acpi-add-reboot-mechanism.patch small-acpica-extension-to-be-able-to-store-the-name-of-fix.patch
git-alsa.patch
working-3d-dri-intel-agpko-resume-for-i815-chip.patch
git-arm.patch
git-arm-fixup.patch
git-dvb-fixup.patch
git-dvb-broke-tda8290.patch
git-hwmon.patch
ia64-slim-down-__clear_bit_unlock-checkpatch-fixes.patch
elantech-touchpad-driver-fix.patch
git-jg-misc-hisax-fix.patch
git-kvm.patch
git-libata-all.patch
drivers-ata-libata-ehc-fix-printk-warning.patch pata_hpt37x-fix-outstanding-bug-reports-on-the-hpt374-and-37x-cable-detect-checkpatch-fixes.patch ide-arm-hack.patch
git-mtd-fix.patch
lmc_ioctl-dont-return-with-locks-held-fix.patch
git-netdev-all.patch ucc_geth-fix-build-break-introduced-by-commit-09f75cd7bf13720738e6a196cc0107ce9a5bd5a0-checkpatch-fixes.patch update-smc91x-driver-with-arm-versatile-board-info.patch
bluetooth-uninlining.patch
git-nfsd-fixup.patch pcmcia-convert-some-internal-only-ioaddr_t-to-unsigned-int-checkpatch-fixes.patch quirk_vialatency-omit-reading-pci-revision-id-checkpatch-fixes.patch fix-build-breakage-if-sysfs-fix.patch
ips-trim-trailing-whitespace-checkpatch-fixes.patch scsi-gdth-kill-unneeded-irq-argument-checkpatch-fixes.patch scsi-fix-bugs-and-canonicalize-ncr5380_intr-drivers-checkpatch-fixes.patch git-unionfs.patch
vfs-swap-do_ioctl-and-vfs_ioctl-names-fix.patch
git-wireless.patch jiffies_round-jiffies_round_relative-conversion-rt2x00-checkpatch-fixes.patch git-ipwireless-ipwireless_cs_tty-warning-fix.patch
git-x86.patch
git-x86-fixup.patch oprofile-op_model_athalonc-support-for-amd-family10h-barcelona-performance-counters-checkpatch-fixes.patch i386-and-x86_64-randomize-brk-fix.patch x86-make-i8259_64-more-_32-like-checkpatch-fixes.patch x86-arch_register_cpu-section-fix.patch mips-undo-locking-on-error-path-returns-checkpatch-fixes.patch pidns-place-under-config_experimental-checkpatch-fixes.patch fix-64kb-blocksize-in-ext3-directories-checkpatch-fixes.patch file-capabilities-allow-sigcont-within-session-v2-checkpatch-fixes.patch pagecache-zeroing-zero_user_segment-zero_user_segments-and-zero_user-fix.patch pagecache-zeroing-zero_user_segment-zero_user_segments-and-zero_user-fix-2.patch i386-resolve-dependency-of-asm-i386-pgtableh-on-highmemh-checkpatch-fixes.patch slub-fix-coding-style-violations-checkpatch-fixes.patch slub-provide-unique-end-marker-for-each-slab-fix.patch slub-do-our-own-locking-via-slab_lock-and-slab_unlock-checkpatch-fixes.patch bufferhead-revert-constructor-removal-checkpatch-fixes.patch maps4-make-page-monitoring-proc-file-optional-fix.patch hugetlb-split-alloc_huge_page-into-private-and-shared-components-checkpatch-fixes.patch vmscan-give-referenced-active-and-unmapped-pages-a-second-trip-around-the-lru.patch vm-dont-run-touch_buffer-during-buffercache-lookups.patch pm-qos-infrastructure-and-interface.patch pm-qos-infrastructure-and-interface-static-initialization-with-blocking-notifiers.patch cris-build-fixes-atomich-needs-compilerh-fix.patch cris-build-fixes-update-eth_v10c-ethernet-driver-fix.patch cris-build-fixes-fix-mtdramh-checkpatch-fixes.patch cris-build-fixes-fixes-in-arch-cris-kernel-timec-checkpatch-fixes.patch cris-remove-mtd_amstd-and-mtd_obsolete_chips-take-two-checkpatch-fixes.patch uml-get-rid-of-asmlinkage-checkpatch-fixes.patch uml-improve-detection-of-host-cmov-checkpatch-fixes.patch uml-further-bugsc-tidying-checkpatch-fixes.patch
deprecate-smbfs-in-favour-of-cifs.patch
procfs-detect-duplicate-names.patch kernel-printkc-concerns-about-the-console-handover.patch fix-versus-precedence-in-various-places-checkpatch-fixes.patch pie-executable-randomization.patch
pie-executable-randomization-checkpatch-fixes.patch
riscom8-fix-smp-brokenness-fix.patch use-macros-instead-of-task_-flags-checkpatch-fixes.patch sound-oss-pss-set_io_base-always-returns-success-mark-it-void-checkpatch-fixes.patch remove-warnings-for-longstanding-conditions-fix.patch parallel-port-convert-port_mutex-to-the-mutex-api-checkpatch-fixes.patch remove-support-for-un-needed-_extratext-section-checkpatch-fixes.patch allow-auto-destruction-of-loop-devices-checkpatch-fixes.patch scheduled-oss-driver-removal-fix.patch
remove-__attribute_used__-checkpatch-fixes.patch
sync_sb_inodes-propagate-errors.patch
bas_gigaset-suspend-support-fix.patch
64-bit-i_version-afs-fixes.patch
kill-filp_open-checkpatch-fixes.patch r-o-bind-mounts-elevate-write-count-during-entire-ncp_ioctl-fix.patch r-o-bind-mounts-elevate-write-count-for-do_utimes.patch r-o-bind-mounts-elevate-write-count-for-some-ioctls-checkpatch-fixes.patch r-o-bind-mounts-elevate-write-count-for-some-ioctls-vs-forbid-user-to-change-file-flags-on-quota-files.patch r-o-bind-mounts-nfs-check-mnt-instead-of-superblock-directly-checkpatch-fixes.patch slab-api-remove-useless-ctor-parameter-and-reorder-parameters-vs-revoke.patch revoke-wire-up-i386-system-calls.patch
revoke-vs-git-block.patch
cgroup-simplify-space-stripping-fix.patch
memory-controller-memory-accounting-v7.patch memory-controller-add-per-container-lru-and-reclaim-v7.patch memory-controller-oom-handling-v7.patch memory-controller-add-switch-to-control-what-type-of-pages-to-limit-v7.patch memcontrol-move-oom-task-exclusion-to-tasklist.patch memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-checkpatch-fixes.patch memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-fix-1.patch memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-uninlining.patch memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-fix-2.patch memory-cgroup-enhancements-add-memorystat-file-checkpatch-fixes.patch drivers-edac-add-marvell-mv64x60-driver-fix.patch introduce-flags-for-reserve_bootmem-checkpatch-fixes.patch iget-stop-affs-from-using-iget-and-read_inode-try-checkpatch-fixes.patch iget-stop-efs-from-using-iget-and-read_inode-try-checkpatch-fixes.patch iget-stop-ext2-from-using-iget-and-read_inode-try-checkpatch-fixes.patch iget-stop-ext3-from-using-iget-and-read_inode-try-checkpatch-fixes.patch iget-stop-freevxfs-from-using-iget-and-read_inode-checkpatch-fixes.patch iget-stop-the-minix-filesystem-from-using-iget-and-checkpatch-fixes.patch iget-stop-procfs-from-using-iget-and-read_inode-checkpatch-fixes.patch iget-stop-qnx4-from-using-iget-and-read_inode-try-checkpatch-fixes.patch iget-stop-romfs-from-using-iget-and-read_inode-checkpatch-fixes.patch iget-stop-the-sysv-filesystem-from-using-iget-and-checkpatch-fixes.patch iget-stop-ufs-from-using-iget-and-read_inode-try-checkpatch-fixes.patch iget-stop-hostfs-from-using-iget-and-read_inode-checkpatch-fixes.patch dhowells-broke-unionfs.patch embed-a-struct-path-into-struct-nameidata-instead-of-nd-dentrymnt-checkpatch-fixes.patch one-less-parameter-to-__d_path-checkpatch-fixes.patch d_path-use-struct-path-in-struct-avc_audit_data-checkpatch-fixes.patch d_path-make-get_dcookie-use-a-struct-path-argument-checkpatch-fixes.patch use-struct-path-in-struct-svc_export-checkpatch-fixes.patch make-copy_from_user_inatomic-not-zero-the-tail-on-i386-vs-reiser4.patch
reiser4.patch
page-owner-tracking-leak-detector.patch
nr_blockdev_pages-in_interrupt-warning.patch
slab-leaks3-default-y.patch
profile-likely-unlikely-macros-fix.patch
put_bh-debug.patch
kmap_atomic-debugging.patch
shrink_slab-handle-bad-shrinkers.patch
getblk-handle-2tb-devices.patch
w1-build-fix.patch

#1 lore raw

PATCH 1/1 IGET: Stop UnionFS from using iget() and read_inode()

From: David Howells <[email protected]>

Stop the UnionFS filesystem from using iget() and read_inode(). Replace unionfs_read_inode() with unionfs_iget(), and call that instead of iget(). unionfs_iget() then uses iget_locked() directly and returns a proper error code instead of an inode in the event of an error.

unionfs_fill_super() returns any error incurred when getting the root inode instead of EINVAL.

---

 fs/unionfs/main.c  |   11 +++++------
 fs/unionfs/super.c |   23 +++++++++++++++++------
 fs/unionfs/union.h |    1 +
 3 files changed, 23 insertions(+), 12 deletions(-)
fs/unionfs/main.c +5 -6
index 4faae44..8d28520 100644
@@ -104,9 +104,8 @@ struct dentry *unionfs_interpose(struct dentry *dentry, struct super_block *sb,
 	BUG_ON(is_negative_dentry);
 
 	/*
-	 * We allocate our new inode below, by calling iget.
-	 * iget will call our read_inode which will initialize some
-	 * of the new inode's fields
+	 * We allocate our new inode below by calling unionfs_iget,
+	 * which will initialize some of the new inode's fields
 	 */
 
 	/*
@@ -128,9 +127,9 @@ struct dentry *unionfs_interpose(struct dentry *dentry, struct super_block *sb,
 		}
 	} else {
 		/* get unique inode number for unionfs */
-		inode = iget(sb, iunique(sb, UNIONFS_ROOT_INO));
-		if (!inode) {
-			err = -EACCES;
+		inode = unionfs_iget(sb, iunique(sb, UNIONFS_ROOT_INO));
+		if (IS_ERR(inode)) {
+			err = PTR_ERR(inode);
 			goto out;
 		}
 		if (atomic_read(&inode->i_count) > 1)
fs/unionfs/super.c +17 -6
index 4e0fe7c..c9d4562 100644
@@ -24,14 +24,22 @@
  */
 static struct kmem_cache *unionfs_inode_cachep;
 
-static void unionfs_read_inode(struct inode *inode)
+struct inode *unionfs_iget(struct super_block *sb, unsigned long ino)
 {
 	extern struct address_space_operations unionfs_aops;
 	int size;
-	struct unionfs_inode_info *info = UNIONFS_I(inode);
+	struct unionfs_inode_info *info;
+	struct inode *inode;
 
-	unionfs_read_lock(inode->i_sb);
+	inode = iget_locked(sb, ino);
+	if (!inode)
+		return ERR_PTR(-ENOMEM);
+	if (!(inode->i_state & I_NEW))
+		return inode;
 
+	unionfs_read_lock(sb);
+
+	info = UNIONFS_I(inode);
 	memset(info, 0, offsetof(struct unionfs_inode_info, vfs_inode));
 	info->bstart = -1;
 	info->bend = -1;
@@ -47,7 +55,9 @@ static void unionfs_read_inode(struct inode *inode)
 	if (!info->lower_inodes) {
 		printk(KERN_ERR "unionfs: no kernel memory when allocating "
 		       "lower-pointer array!\n");
-		BUG();
+		iget_failed(inode);
+		unionfs_read_unlock(sb);
+		return ERR_PTR(-ENOMEM);
 	}
 
 	inode->i_version++;
@@ -56,7 +66,9 @@ static void unionfs_read_inode(struct inode *inode)
 
 	inode->i_mapping->a_ops = &unionfs_aops;
 
-	unionfs_read_unlock(inode->i_sb);
+	unlock_new_inode(inode);
+	unionfs_read_unlock(sb);
+	return inode;
 }
 
 /*
@@ -996,7 +1008,6 @@ out:
 }
 
 struct super_operations unionfs_sops = {
-	.read_inode	= unionfs_read_inode,
 	.delete_inode	= unionfs_delete_inode,
 	.put_super	= unionfs_put_super,
 	.statfs		= unionfs_statfs,
fs/unionfs/union.h +1 -0
index 97da8f9..2653802 100644
@@ -322,6 +322,7 @@ extern int unionfs_fsync(struct file *file, struct dentry *dentry,
 extern int unionfs_fasync(int fd, struct file *file, int flag);
 
 /* Inode operations */
+extern struct inode *unionfs_iget(struct super_block *sb, unsigned long ino);
 extern int unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 			  struct inode *new_dir, struct dentry *new_dentry);
 extern int unionfs_unlink(struct inode *dir, struct dentry *dentry);
#2 lore raw

Re: [PATCH] IGET: Stop UnionFS from using iget() and read_inode()

Quoted 11 lines · David Howells

From: David Howells <[email protected]>

Stop the UnionFS filesystem from using iget() and read_inode(). Replace unionfs_read_inode() with unionfs_iget(), and call that instead of iget(). unionfs_iget() then uses iget_locked() directly and returns a proper error code instead of an inode in the event of an error.

unionfs_fill_super() returns any error incurred when getting the root inode instead of EINVAL.

[...]

Thanks. I tested this code and it passed all my tests. I'll shortly submit a slightly revised patch which applies cleanly against the unionfs code in -mm.

Cheers,
Erez.

#3 lore raw

Re: [Unionfs] Re: [PATCH] IGET: Stop UnionFS from using iget() and read_inode()

Quoted 11 lines · Erez Zadok
Quoted 10 lines · David Howells

From: David Howells <[email protected]>

Stop the UnionFS filesystem from using iget() and read_inode(). Replace unionfs_read_inode() with unionfs_iget(), and call that instead of iget(). unionfs_iget() then uses iget_locked() directly and returns a proper error code instead of an inode in the event of an error.

unionfs_fill_super() returns any error incurred when getting the root inode instead of EINVAL.

Quoted 6 lines
Quoted 1 line

[...]

Thanks. I tested this code and it passed all my tests. I'll shortly submit a slightly revised patch which applies cleanly against the unionfs code in -mm.

Does your test set include readahead-list? I can't get it to work with a union mounted filesystem without segfault'ing and kernel oops'ing.

Paul Albrecht

#4 lore raw

Re: [Unionfs] Re: [PATCH] IGET: Stop UnionFS from using iget() and read_inode()

Quoted 2 lines · Paul Albrecht

Does your test set include readahead-list? I can't get it to work with a union mounted filesystem without segfault'ing and kernel oops'ing.

Is that with or without this patch?

David

#5 lore raw

Re: [Unionfs] Re: [PATCH] IGET: Stop UnionFS from using iget() and read_inode()

Quoted 6 lines · David Howells
Quoted 2 lines · Paul Albrecht

Does your test set include readahead-list? I can't get it to work with a union mounted filesystem without segfault'ing and kernel oops'ing.

Is that with or without this patch?

Without ... what's the difference? I asked a specific question about the test set that was used to validate unionfs and your fix.

Paul Albrecht

#6 lore raw

Re: [Unionfs] Re: [PATCH] IGET: Stop UnionFS from using iget() and read_inode()

Quoted 2 lines · Paul Albrecht

Without ... what's the difference? I asked a specific question about the test set that was used to validate unionfs and your fix.

I was just checking it wasn't something my patch introduced.

David

#7 lore raw

Re: [Unionfs] Re: [PATCH] IGET: Stop UnionFS from using iget() and read_inode()

In reply to Paul Albrecht
Quoted 6 lines · Paul Albrecht
Quoted 5 lines · David Howells
Quoted 2 lines · Paul Albrecht

Does your test set include readahead-list? I can't get it to work with a union mounted filesystem without segfault'ing and kernel oops'ing.

Quoted 6 lines
Quoted 1 line

Is that with or without this patch?

Without ... what's the difference? I asked a specific question about the test set that was used to validate unionfs and your fix.

Paul Albrecht

Paul,

I'll check out the readahead stuff shortly. I doubt the iget patch has anything to do with it.

Cheers,
Erez.