Amerigo Wang | 1 Dec 2009 03:34
Picon
Favicon

[Patch] fs: remove a useless BUG()


This BUG() is suspicious, it makes its following statements
unreachable, and it seems to be useless, since the caller
of this function already handles the failure properly.
Remove it.

Signed-off-by: WANG Cong <amwang <at> redhat.com>
Cc: Alexander Viro <viro <at> zeniv.linux.org.uk>
Cc: Jens Axboe <jens.axboe <at> oracle.com>
Cc: Nick Piggin <npiggin <at> suse.de>
Cc: "Theodore Ts'o" <tytso <at> mit.edu>

---
diff --git a/fs/buffer.c b/fs/buffer.c
index 6fa5302..ac111d7 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
 <at>  <at>  -1041,7 +1041,6  <at>  <at>  grow_dev_page(struct block_device *bdev, sector_t block,
 	return page;

 failed:
-	BUG();
 	unlock_page(page);
 	page_cache_release(page);
 	return NULL;
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

(Continue reading)

Erez Zadok | 1 Dec 2009 05:10
Picon
Favicon

Re: [PATCH 25/41] union-mount: stop lookup when directory has S_OPAQUE flag set

In message <1256152779-10054-26-git-send-email-vaurora <at> redhat.com>, Valerie Aurora writes:
> From: Jan Blunck <jblunck <at> suse.de>
> 
> Honor the S_OPAQUE flag in the union path lookup.

Was it intentional to have a separate patch which adds opaque directories
support, or should it be part of the larger patch #24?

> 
> Signed-off-by: Jan Blunck <jblunck <at> suse.de>
> Signed-off-by: Valerie Aurora <vaurora <at> redhat.com>
> ---
>  fs/namei.c |   17 ++++++++++++++---
>  1 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index b279686..8ebbf4f 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
>  <at>  <at>  -523,6 +523,9  <at>  <at>  static int __cache_lookup_build_union(struct nameidata *nd, struct qstr *name,
>  			path_put(&last);
>  		last.dentry = dentry;
>  		last.mnt = mntget(nd->path.mnt);
> +
> +		if (IS_OPAQUE(last.dentry->d_inode))
> +			break;
>  	}
>  
>  	if (last.dentry != path->dentry)
>  <at>  <at>  -562,7 +565,8  <at>  <at>  static int cache_lookup_union(struct nameidata *nd, struct qstr *name,
(Continue reading)

Erez Zadok | 1 Dec 2009 05:13
Picon
Favicon

Re: [PATCH 27/41] union-mount: in-kernel file copy between union mounted filesystems

In message <1256152779-10054-28-git-send-email-vaurora <at> redhat.com>, Valerie Aurora writes:
> This patch introduces in-kernel file copy between union mounted
> filesystems. When a file is opened for writing but resides on a lower (thus
> read-only) layer of the union stack it is copied to the topmost union layer
> first.

There are many stupid applications out there which open(O_RW)/close() w/o
ever writing anything.  You'll do a lot of unnecessary copyup this way.  In
Unionfs I had to implement lazy copyup upon the first actual ->write to a
file which was opened for writing and was a candidate for copyup at open()
time.

Also, some apps open a file with O_WR|O_TRUNC, b/c they want to overwrite
the file with new data (and they don't want to truncate at file close time).
But, in your case, you'll do all the hard work of copyup only to find you
have to discard all that copied up data.  You need an optimization for
open(O_TRUNC) as well.

These two optimizations can be put on the future todo list for now.

> This patch uses the do_splice() for doing the in-kernel file copy.
> 
> XXX - Optimize for non-union mounts in union mount enabled kernels
> (esp. call to is_unionized() in do_filp_open()).
> 
> XXX - "flags" argument to union_copyup() is unused - bug?  Leftover
> code?
> 
> Signed-off-by: Bharata B Rao <bharata <at> in.ibm.com>
> Signed-off-by: Jan Blunck <jblunck <at> suse.de>
(Continue reading)

Erez Zadok | 1 Dec 2009 05:14
Picon
Favicon

Re: [PATCH 30/41] fallthru: Basic fallthru definitions

BTW, your patch set has an awkward order: you have some vfs and ext2/tmpfs
patches, then UM patches, then fallthru patches for specific file systems,
then UM patches again.  Is it possible to order them so all UM patches go in
order; all lower-level F/S patches are also sequential; etc.?

In message <1256152779-10054-31-git-send-email-vaurora <at> redhat.com>, Valerie Aurora writes:
> Define the fallthru dcache flag and file system op.
> 
> Signed-off-by: Valerie Aurora <vaurora <at> redhat.com>
> ---
>  include/linux/dcache.h |    6 ++++++
>  include/linux/fs.h     |    1 +
>  2 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/dcache.h b/include/linux/dcache.h
> index 730c432..a55f79f 100644
> --- a/include/linux/dcache.h
> +++ b/include/linux/dcache.h
>  <at>  <at>  -193,6 +193,7  <at>  <at>  d_iput:		no		no		no       yes
>  
>  #define DCACHE_COOKIE		0x0040	/* For use by dcookie subsystem */
>  #define DCACHE_WHITEOUT		0x0080	/* This negative dentry is a whiteout */
> +#define DCACHE_FALLTHRU		0x0100	/* Keep looking in the file system below */
>  
>  #define DCACHE_FSNOTIFY_PARENT_WATCHED	0x0080 /* Parent inode is watched by some fsnotify listener */
>  
>  <at>  <at>  -381,6 +382,11  <at>  <at>  static inline int d_is_whiteout(struct dentry *dentry)
>  	return (dentry->d_flags & DCACHE_WHITEOUT);
>  }
>  
(Continue reading)

Erez Zadok | 1 Dec 2009 05:15
Picon
Favicon

Re: [PATCH 31/41] fallthru: Support for fallthru entries in union mount lookup

In message <1256152779-10054-32-git-send-email-vaurora <at> redhat.com>, Valerie Aurora writes:
> A fallthru directory entry overrides the opaque flag for its parent
> directory (for this directory entry only).  Before, we stopped
> building the union stack when we encountered an opaque directory; now
> we include directories below opaque directories in the union stack and
> check for opacity during lookup.
> 
> Signed-off-by: Jan Blunck <jblunck <at> suse.de>
> Signed-off-by: Valerie Aurora <vaurora <at> redhat.com>
> ---
>  fs/dcache.c |    7 +++----
>  fs/namei.c  |   59 +++++++++++++++++++++++++++++++++++++++++++++--------------
>  2 files changed, 48 insertions(+), 18 deletions(-)
> 
> diff --git a/fs/dcache.c b/fs/dcache.c
> index d80a3bb..ca8a661 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
>  <at>  <at>  -1086,7 +1086,7  <at>  <at>  struct dentry *d_alloc_name(struct dentry *parent, const char *name)
>  static void __d_instantiate(struct dentry *dentry, struct inode *inode)
>  {
>  	if (inode) {
> -		dentry->d_flags &= ~DCACHE_WHITEOUT;
> +		dentry->d_flags &= ~(DCACHE_WHITEOUT|DCACHE_FALLTHRU);
>  		list_add(&dentry->d_alias, &inode->i_dentry);
>  	}
>  	dentry->d_inode = inode;
>  <at>  <at>  -1638,9 +1638,8  <at>  <at>  void d_delete(struct dentry * dentry)
>  
>  static void __d_rehash(struct dentry * entry, struct hlist_head *list)
(Continue reading)

Erez Zadok | 1 Dec 2009 05:17
Picon
Favicon

Re: [PATCH 33/41] fallthru: jffs2 fallthru support

In message <1256152779-10054-34-git-send-email-vaurora <at> redhat.com>, Valerie Aurora writes:
> From: Felix Fietkau <nbd <at> openwrt.org>
> 
> Add support for fallthru dentries to jffs2.
> 
> Cc: David Woodhouse <dwmw2 <at> infradead.org>
> Cc: linux-mtd <at> lists.infradead.org
> Signed-off-by: Felix Fietkau <nbd <at> openwrt.org>
> Signed-off-by: Valerie Aurora <vaurora <at> redhat.com>
> ---
>  fs/jffs2/dir.c        |   31 ++++++++++++++++++++++++++++++-
>  include/linux/jffs2.h |    6 ++++++
>  2 files changed, 36 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
> index 46a2e1b..544d6c5 100644
> --- a/fs/jffs2/dir.c
> +++ b/fs/jffs2/dir.c
>  <at>  <at>  -35,6 +35,7  <at>  <at>  static int jffs2_rename (struct inode *, struct dentry *,
>  			 struct inode *, struct dentry *);
>  
>  static int jffs2_whiteout (struct inode *, struct dentry *, struct dentry *);
> +static int jffs2_fallthru (struct inode *, struct dentry *);
>  
>  const struct file_operations jffs2_dir_operations =
>  {
>  <at>  <at>  -57,6 +58,7  <at>  <at>  const struct inode_operations jffs2_dir_inode_operations =
>  	.rmdir =	jffs2_rmdir,
>  	.mknod =	jffs2_mknod,
>  	.rename =	jffs2_rename,
(Continue reading)

Erez Zadok | 1 Dec 2009 05:18
Picon
Favicon

Re: [PATCH 35/41] union-mount: Copy up directory entries on first readdir()

In message <1256152779-10054-36-git-send-email-vaurora <at> redhat.com>, Valerie Aurora writes:
> readdir() in union mounts is implemented by copying up all visible
> directory entries from the lower level directories to the topmost
> directory.  Directory entries that refer to lower level file system
> objects are marked as "fallthru" in the topmost directory.
> 
> Thanks to Felix Fietkau <nbd <at> openwrt.org> for a bug fix.
> 
> XXX - Do we need i_mutex on lower layer?
> XXX - Rewrite for two layers only?
> 
> Signed-off-by: Valerie Aurora <vaurora <at> redhat.com>
> Signed-off-by: Felix Fietkau <nbd <at> openwrt.org>
> ---
>  fs/readdir.c          |   17 +++++
>  fs/union.c            |  171 +++++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/union.h |    2 +
>  3 files changed, 190 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/readdir.c b/fs/readdir.c
> index 3a48491..cfeacd8 100644
> --- a/fs/readdir.c
> +++ b/fs/readdir.c
>  <at>  <at>  -16,6 +16,8  <at>  <at> 
>  #include <linux/security.h>
>  #include <linux/syscalls.h>
>  #include <linux/unistd.h>
> +#include <linux/union.h>
> +#include <linux/mount.h>
>  
(Continue reading)

Erez Zadok | 1 Dec 2009 05:26
Picon
Favicon

Re: [PATCH 38/41] union-mount: Make pivot_root work with union mounts

In message <1256152779-10054-39-git-send-email-vaurora <at> redhat.com>, Valerie Aurora writes:
> When moving a union mount, follow it down to the bottom layer and move
> that instead of just the top layer.
> 
> Signed-off-by: Valerie Aurora <vaurora <at> redhat.com>
> ---
>  fs/namespace.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 9b71743..6ac5fc1 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
>  <at>  <at>  -2282,6 +2282,15  <at>  <at>  SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
>  	if (d_unlinked(old.dentry))
>  		goto out2;
>  	error = -EBUSY;
> +	/*
> +	 * follow_union_down() only goes one layer down.  We want the
> +	 * bottom-most layer here - if we move that around, all the
> +	 * layers on top move with it.  But if we ever allow more than
> +	 * two layers, the below two will both need to be in while()
> +	 * loops.
> +	 */

Given the nature of this comment, I'd stick an "XXX" there for easier
ability to grep-the-src-for-issues.

> +	follow_union_down(&new.mnt, &new.dentry);
> +	follow_union_down(&root.mnt, &root.dentry);
(Continue reading)

Erez Zadok | 1 Dec 2009 05:34
Picon
Favicon

Re: [PATCH 39/41] union-mount: Ignore read-only file system in permission checks

In message <1256152779-10054-40-git-send-email-vaurora <at> redhat.com>, Valerie Aurora writes:
> In certain cases, we check a file for write access before it has been
> copied up to the top-level fs.  We don't want to fail because the
> bottom layer is read-only - of course it is - so skip that check in
> those cases.
> 
> Thanks to Felix Fietkau <nbd <at> openwrt.org> for a bug fix.
> 
> XXX - Document when to call union_permission() vs. inode_permission()
> XXX - Kinda gross.  Probably a simpler solution.
> 
> Signed-off-by: Valerie Aurora <vaurora <at> redhat.com>
> ---
>  fs/namei.c            |   21 +++++++++++++++++----
>  fs/open.c             |    8 ++++++--
>  fs/union.c            |   32 ++++++++++++++++++++++++++++++--
>  include/linux/fs.h    |    1 +
>  include/linux/union.h |    2 ++
>  5 files changed, 56 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 61e94aa..a8d3acf 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
>  <at>  <at>  -230,16 +230,17  <at>  <at>  int generic_permission(struct inode *inode, int mask,
>  }
>  
>  /**
> - * inode_permission  -  check for access rights to a given inode
> + * __inode_permission  -  check for access rights to a given inode
(Continue reading)

Erez Zadok | 1 Dec 2009 05:50
Picon
Favicon

Re: [PATCH 40/41] union-mount: Make truncate work in all its glorious UNIX variations

In message <1256152779-10054-41-git-send-email-vaurora <at> redhat.com>, Valerie Aurora writes:
> Implement truncate(), ftruncate(), and open(O_TRUNC) for union mounts.
> 
> This moves the union_copyup() in do_filp_open() down below may_open()
> - this way you don't copy up a file you don't even have permission to
> open.
> 
> may_open() now takes a nameidata * because it may have to do a
> union_copyup() internally if O_TRUNC is specified.  It's a trivial
> change, all callers were just doing "may_open(&nd.path, ...)" anyway.
> It kinda sucks, but may_open() auto-magically doing a truncate also
> sucks (may open? may truncate, too!).

Hmmm, perhaps may_open needs to be renamed then? (may_rename_and_truncate?)

> XXX - Only copy up the bytes that won't be truncated.
> XXX - Re-organize code. may_open() especially blah.
> XXX - truncate() implemented as in-kernel file open and ftruncate()
> XXX - Split up into smaller pieces
[...]

Erez.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane