Re: File system awareness (or lack thereof) of vfs granting of leases

2007-02-17 Thread J. Bruce Fields
On Sat, Feb 17, 2007 at 12:32:42AM -0500, Wendy Cheng wrote:
> Robert Rappaport wrote:
> 
> >[snip]
> >   This is because the vfs running on the same node where the
> >samba server is running is not necessarily aware of all accesses to
> >the file on which it is granting a lease.  Since vfs does not
> >currently inform file systems about the granting and rescinding of
> >leases, a clustered file system cannot allow a samba server to support
> >OpLocks on its files and this has a negative impact on performance.
> >
> >What I think is needed is to add a file systems defined
> >file_operations function, that would be invoked when vfs is
> >considering the granting of a lease on a file associated with an
> >inode.  Such an enhancement would allow a file system to be come aware
> >of vfs lease activity and allow it to support this activity.
> >
> NFS has similar issues because Linux NLM-VFS does not invoke server side 
> filesystem specific lock method. This implies NFS client applications is 
> not able to use posix locks to coordinate file access across different 
> nodes  with a cluster filesystem, even the cluster filesystem itself 
> does support posix locking.

We also have the same problem with leases, since we're using leases to
implement NFSv4 delegations.  There's a simple-minded patch here:


http://linux-nfs.org/cgi-bin/gitweb.cgi?p=bfields-2.6.git;a=commitdiff;h=4e8aff5dabe07b2e4e95ef0c741a34f65409087f

I'm not really sure if it's right.

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


[git patch, resend] remove JFFS v1

2007-02-17 Thread Jeff Garzik

[just sent this upstream; obvious file-removal patch snipped for size]

(resend) 

Why:Unmaintained for years, superceded by JFFS2 for years.

Please pull from 'kill-jffs' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git kill-jffs

to receive the following updates:

 Documentation/feature-removal-schedule.txt |7 -
 fs/Kconfig |   26 -
 fs/Makefile|1 -
 fs/jffs/Makefile   |   11 -
 fs/jffs/inode-v23.c| 1847 ---
 fs/jffs/intrep.c   | 3449 
 fs/jffs/intrep.h   |   58 -
 fs/jffs/jffs_fm.c  |  798 ---
 fs/jffs/jffs_fm.h  |  149 --
 fs/jffs/jffs_proc.c|  261 ---
 fs/jffs/jffs_proc.h|   28 -
 include/linux/jffs.h   |  224 --
 12 files changed, 0 insertions(+), 6859 deletions(-)
 delete mode 100644 fs/jffs/Makefile
 delete mode 100644 fs/jffs/inode-v23.c
 delete mode 100644 fs/jffs/intrep.c
 delete mode 100644 fs/jffs/intrep.h
 delete mode 100644 fs/jffs/jffs_fm.c
 delete mode 100644 fs/jffs/jffs_fm.h
 delete mode 100644 fs/jffs/jffs_proc.c
 delete mode 100644 fs/jffs/jffs_proc.h
 delete mode 100644 include/linux/jffs.h

Jeff Garzik (1):
  Remove JFFS (version 1), as scheduled.

diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index c585aa8..e1bc0c5 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -306,13 +306,6 @@ Who:   Len Brown <[EMAIL PROTECTED]>
 
 ---
 
-What:  JFFS (version 1)
-When:  2.6.21
-Why:   Unmaintained for years, superceded by JFFS2 for years.
-Who:   Jeff Garzik <[EMAIL PROTECTED]>
-

-
 What:   sk98lin network driver
 When:   July 2007
 Why:In kernel tree version of driver is unmaintained. Sk98lin driver
diff --git a/fs/Kconfig b/fs/Kconfig
index a722b5a..3c4886b 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1189,32 +1189,6 @@ config EFS_FS
  To compile the EFS file system support as a module, choose M here: the
  module will be called efs.
 
-config JFFS_FS
-   tristate "Journalling Flash File System (JFFS) support"
-   depends on MTD && BLOCK && BROKEN
-   help
- JFFS is the Journalling Flash File System developed by Axis
- Communications in Sweden, aimed at providing a crash/powerdown-safe
- file system for disk-less embedded devices. Further information is
- available at ().
-
- NOTE: This filesystem is deprecated and is scheduled for removal in
- 2.6.21.  See Documentation/feature-removal-schedule.txt
-
-config JFFS_FS_VERBOSE
-   int "JFFS debugging verbosity (0 = quiet, 3 = noisy)"
-   depends on JFFS_FS
-   default "0"
-   help
- Determines the verbosity level of the JFFS debugging messages.
-
-config JFFS_PROC_FS
-   bool "JFFS stats available in /proc filesystem"
-   depends on JFFS_FS && PROC_FS
-   help
- Enabling this option will cause statistics from mounted JFFS file 
systems
- to be made available to the user in the /proc/fs/jffs/ directory.
-
 config JFFS2_FS
tristate "Journalling Flash File System v2 (JFFS2) support"
select CRC32
diff --git a/fs/Makefile b/fs/Makefile
index b9ffa63..9edf411 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -94,7 +94,6 @@ obj-$(CONFIG_HPFS_FS) += hpfs/
 obj-$(CONFIG_NTFS_FS)  += ntfs/
 obj-$(CONFIG_UFS_FS)   += ufs/
 obj-$(CONFIG_EFS_FS)   += efs/
-obj-$(CONFIG_JFFS_FS)  += jffs/
 obj-$(CONFIG_JFFS2_FS) += jffs2/
 obj-$(CONFIG_AFFS_FS)  += affs/
 obj-$(CONFIG_ROMFS_FS) += romfs/
[snip file deletion patch]
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Fix d_path for lazy unmounts

2007-02-17 Thread Andreas Gruenbacher
On Wednesday 14 February 2007 19:13, Andreas Gruenbacher wrote:
> So here is how this could be implemented. See the lengthy explanations in
> the patch headers, too.

Turns out I messed up with one of Neil's review comments. Here is yet another 
update.

With this fix, everything works as expected in testing now. sys_getcwd 
returns -ENOENT for paths not connected to the chroot. /proc/mounts 
and /proc/$pid/mountstats never contain a relative path. gnome-vfs-daemon 
seems quite happy again.

Andreas
Fix __d_path() for lazy unmounts and make it unambiguous

First, when d_path() hits a lazily unmounted mount point, it tries to
prepend the name of the lazily unmounted dentry to the path name. It
gets this wrong, and also overwrites the slash that separates the name
from the following pathname component.

Second, it isn't always possible to tell from the __d_path result
whether the specified root and rootmnt (i.e., the chroot) was reached:
lazy unmounts of bind mounts will produce a path that does start with a
non-slash so we can tell from that, but other lazy unmounts will produce
a path that starts with a slash, just like "ordinary" paths.

Third, sys_getcwd() shouldn't return disconnected paths. The patch
checks for that, and makes it fail with -ENOENT in that case.

The attached patch cleans up __d_path() to fix the bug with overlapping
pathname components. It also adds a @fail_deleted argument, which allows
to get rid of some of the mess in sys_getcwd(). We make sure that paths
will only start with a slash if the path leads all the way up to the
root. If the resulting path would otherwise be empty, we return "."
instead so that some users of seq_path for files in /proc won't break.

The @fail_deleted argument allows sys_getcwd() to be simplified.
Grabbing the dcache_lock can be moved into __d_path().

The @fail_deleted argument could be added to d_path() as well: this would
allow callers to recognize deleted files without having to resort to the
ambiguous check for the " (deleted)" string at the end of the pathnames.
This is not currently done, but it might be worthwhile.

Signed-off-by: Andreas Gruenbacher <[EMAIL PROTECTED]>
Reviewed-by: NeilBrown <[EMAIL PROTECTED]>

Index: b/fs/dcache.c
===
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1732,52 +1732,51 @@ shouldnt_be_hashed:
 }
 
 /**
- * d_path - return the path of a dentry
+ * __d_path - return the path of a dentry
  * @dentry: dentry to report
  * @vfsmnt: vfsmnt to which the dentry belongs
  * @root: root dentry
  * @rootmnt: vfsmnt to which the root dentry belongs
  * @buffer: buffer to return value in
  * @buflen: buffer length
+ * @fail_deleted: what to return for deleted files
  *
- * Convert a dentry into an ASCII path name. If the entry has been deleted
+ * Convert a dentry into an ASCII path name. If the entry has been deleted,
+ * then if @fail_deleted is true, ERR_PTR(-ENOENT) is returned. Otherwise,
  * the string " (deleted)" is appended. Note that this is ambiguous.
  *
- * Returns the buffer or an error code if the path was too long.
+ * If @dentry is not connected to @root, the path returned will be relative
+ * (i.e., it will not start with a slash).
  *
- * "buflen" should be positive. Caller holds the dcache_lock.
+ * Returns the buffer or an error code.
  */
-static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
-			struct dentry *root, struct vfsmount *rootmnt,
-			char *buffer, int buflen)
-{
-	char * end = buffer+buflen;
-	char * retval;
-	int namelen;
+static char *__d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
+		  struct dentry *root, struct vfsmount *rootmnt,
+		  char *buffer, int buflen, int fail_deleted)
+{
+	int namelen, is_slash;
+
+	if (buflen < 2)
+		return ERR_PTR(-ENAMETOOLONG);
+	buffer += --buflen;
+	*buffer = '\0';
 
-	*--end = '\0';
-	buflen--;
+	spin_lock(&dcache_lock);
 	if (!IS_ROOT(dentry) && d_unhashed(dentry)) {
-		buflen -= 10;
-		end -= 10;
-		if (buflen < 0)
+		if (fail_deleted) {
+			buffer = ERR_PTR(-ENOENT);
+			goto out;
+		}
+		if (buflen < 10)
 			goto Elong;
-		memcpy(end, " (deleted)", 10);
+		buflen -= 10;
+		buffer -= 10;
+		memcpy(buffer, " (deleted)", 10);
 	}
-
-	if (buflen < 1)
-		goto Elong;
-	/* Get '/' right */
-	retval = end-1;
-	*retval = '/';
-
-	for (;;) {
+	while (dentry != root || vfsmnt != rootmnt) {
 		struct dentry * parent;
 
-		if (dentry == root && vfsmnt == rootmnt)
-			break;
 		if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
-			/* Global root? */
 			spin_lock(&vfsmount_lock);
 			if (vfsmnt->mnt_parent == vfsmnt) {
 spin_unlock(&vfsmount_lock);
@@ -1791,33 +1790,63 @@ static char * __d_path( struct dentry *d
 		parent = dentry->d_parent;
 		prefetch(parent);
 		namelen = dentry->d_name.len;
-		buflen -= namelen + 1;
-		if (buflen < 0)
+		if (buflen < namelen + 1)
 			goto Elong;
-		end -= namelen;
-		memcpy(end, dentry->d_name.name, namelen);
-		*--end = '/';
-		retv

Re: [Fwd: [PATCH] consolidate generic_writepages and mpage_writepages]

2007-02-17 Thread Miklos Szeredi
> >Maybe cifs_writepages() too can use this infrastructure, but I'm not
> >touching that with a ten-foot pole.
> >  
> >
> The cifs case ought to be one of the simpler ones, pseudo-code is pretty 
> easy, the hard part is all of the stuff unrelated to cifs:
> Ideally if there were generic functions to help out, cifs writepages 
> would look roughly like the following
> 
> cifs_writepages(struct address_space *mapping, struct writeback_control 
> *wbc)
> {
>
> while (no more pages to write) {
> /* find writeable file handle for this inode */
> /* find the biggest set of contiguous pages that total less than 
> wsize */
> if (packet signing is enabled)
> /* write lock pages so they can not be changed under us 
> while we are calculating the checksum */
>   
>CIFSSMBWrite2(tree_connection, network_file_handle, array of 
> iovecs, number of iovecs);
> 
> if(packet signing was enabled)
> /* unlock pages */
> 
> if(error) {
>  set page errors
>  if (mounted "hard" )
>continue; /* retry */
>  else /* if no retry possible */
>return error to caller;
>}
> update bytes written statistics
> update index to point to next set of pages
> }  /* end while loop */
> }

write_cache_pages() now takes care of the 

 while (no more pages to write) {
 }

part.  All you have to do is to make the body of the loop into a
function and pass it a structure with the data you want to preserve
between invocations.

The hard part is untangling the breaks and continues.

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


[PATCH 1/2] eCryptfs: convert lookup_one_len() to lookup_one_len_nd()

2007-02-17 Thread Josef 'Jeff' Sipek
From: Michael Halcrow <[EMAIL PROTECTED]>

Call the new lookup_one_len_nd() rather than lookup_one_len().  This fixes an
oops when stacked on NFS.

Note that there are still some issues with eCryptfs on NFS having to do with
directory deletion (I'm not getting an oops, just an -EBUSY).

Signed-off-by: Michael Halcrow <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Josef 'Jeff' Sipek <[EMAIL PROTECTED]>
---
 fs/ecryptfs/inode.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 11f5e50..4c3d786 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -283,7 +283,9 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, 
struct dentry *dentry,
int rc = 0;
struct dentry *lower_dir_dentry;
struct dentry *lower_dentry;
+   struct dentry *dentry_save;
struct vfsmount *lower_mnt;
+   struct vfsmount *mnt_save;
char *encoded_name;
unsigned int encoded_namelen;
struct ecryptfs_crypt_stat *crypt_stat = NULL;
@@ -310,9 +312,13 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, 
struct dentry *dentry,
}
ecryptfs_printk(KERN_DEBUG, "encoded_name = [%s]; encoded_namelen "
"= [%d]\n", encoded_name, encoded_namelen);
-   lower_dentry = lookup_one_len(encoded_name, lower_dir_dentry,
- encoded_namelen - 1);
+   dentry_save = nd->dentry;
+   mnt_save = nd->mnt;
+   lower_dentry = lookup_one_len_nd(encoded_name, lower_dir_dentry,
+(encoded_namelen - 1), nd);
kfree(encoded_name);
+   nd->mnt = mnt_save;
+   nd->dentry = dentry_save;
if (IS_ERR(lower_dentry)) {
ecryptfs_printk(KERN_ERR, "ERR from lower_dentry\n");
rc = PTR_ERR(lower_dentry);
-- 
1.5.0.19.gddff

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


[PATCH 2/2] fs/unionfs/: Remove unused structure members & macros

2007-02-17 Thread Josef 'Jeff' Sipek
This patch removes:
- hidden_mnt pointer from struct unionfs_data
- mount_flag from struct unionfs_sb_info
- mount_flag related macros

Signed-off-by: Josef 'Jeff' Sipek <[EMAIL PROTECTED]>
---
 fs/unionfs/union.h |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index fc87b03..60276c7 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -54,9 +54,6 @@
 /* unionfs root inode number */
 #define UNIONFS_ROOT_INO 1
 
-/* Mount time flags */
-#define MOUNT_FLAG(sb) (UNIONFS_SB(sb)->mount_flag)
-
 /* number of characters while generating unique temporary file names */
 #defineUNIONFS_TMPNAM_LEN  12
 
@@ -124,7 +121,6 @@ struct unionfs_dentry_info {
 /* These are the pointers to our various objects. */
 struct unionfs_data {
struct super_block *sb;
-   struct vfsmount *hidden_mnt;
atomic_t sbcount;
int branchperms;
 };
@@ -134,7 +130,6 @@ struct unionfs_sb_info {
int bend;
 
atomic_t generation;
-   unsigned long mount_flag;
struct rw_semaphore rwsem;
 
struct unionfs_data *data;
@@ -341,8 +336,6 @@ static inline int d_deleted(struct dentry *d)
 
 struct dentry *unionfs_lookup_backend(struct dentry *dentry, struct nameidata 
*nd, int lookupmode);
 
-#define IS_SET(sb, check_flag) ((check_flag) & MOUNT_FLAG(sb))
-
 /* unionfs_permission, check if we should bypass error to facilitate copyup */
 #define IS_COPYUP_ERR(err) ((err) == -EROFS)
 
@@ -405,8 +398,6 @@ static inline int is_robranch(const struct dentry *dentry)
 #define UNIONFS_DIR_OPAQUE_NAME "__dir_opaque"
 #define UNIONFS_DIR_OPAQUE UNIONFS_WHPFX UNIONFS_DIR_OPAQUE_NAME
 
-#define VALID_MOUNT_FLAGS (0)
-
 #ifndef DEFAULT_POLLMASK
 #define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
 #endif
-- 
1.5.0.19.gddff

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


[GIT PULL -mm] Unionfs/eCryptfs cleanups

2007-02-17 Thread Josef 'Jeff' Sipek
You can pull from 'master' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/jsipek/unionfs.git

to receive the following:

Josef 'Jeff' Sipek (1):
  fs/unionfs/: Remove unused structure members & macros

Michael Halcrow (1):
  eCryptfs: convert lookup_one_len() to lookup_one_len_nd()

 fs/ecryptfs/inode.c |   10 --
 fs/unionfs/union.h  |9 -
 2 files changed, 8 insertions(+), 11 deletions(-)

Josef 'Jeff' Sipek.


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