Re: [PATCH 0/6][TAKE5] fallocate system call

2007-06-29 Thread Christoph Hellwig
On Thu, Jun 28, 2007 at 11:33:42AM -0700, Andrew Morton wrote:
 I think Mingming was asking that Ted move the current quilt tree into git,
 presumably because she's working off git.
 
 I'm not sure what to do, really.  The core kernel patches need to be in
 Ted's tree for testing but that'll create a mess for me.

Could we please stop this stupid ext4-centrism?  XFS is ready so we can
put in the syscalls backed by XFS.  We have already done this with the xattr
syscalls in 2.4, btw.

Then again I don't think we should put it in quite yet, because this thread
has degraded into creeping featurism, please give me some more time to
preparate a semi-coheret rants about this..

-
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 3/5] Unionfs: Use file-f_path instead of file-f_dentry

2007-06-29 Thread Josef 'Jeff' Sipek
From: Erez Zadok [EMAIL PROTECTED]

Signed-off-by: Erez Zadok [EMAIL PROTECTED]
Signed-off-by: Josef 'Jeff' Sipek [EMAIL PROTECTED]
---
 fs/unionfs/commonfops.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 8527ac6..28cb4e9 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -708,10 +708,10 @@ int unionfs_flush(struct file *file, fl_owner_t id)
 {
int err = 0;
struct file *lower_file = NULL;
-   struct dentry *dentry = file-f_dentry;
+   struct dentry *dentry = file-f_path.dentry;
int bindex, bstart, bend;
 
-   unionfs_read_lock(file-f_path.dentry-d_sb);
+   unionfs_read_lock(dentry-d_sb);
 
if ((err = unionfs_file_revalidate(file, 1)))
goto out;
@@ -745,6 +745,6 @@ int unionfs_flush(struct file *file, fl_owner_t id)
 out_lock:
unionfs_unlock_dentry(dentry);
 out:
-   unionfs_read_unlock(file-f_path.dentry-d_sb);
+   unionfs_read_unlock(dentry-d_sb);
return err;
 }
-- 
1.5.2.2.238.g7cbf2f2

-
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 4/5] Unionfs: Clarification comment for unionfs_lookup

2007-06-29 Thread Josef 'Jeff' Sipek
From: Erez Zadok [EMAIL PROTECTED]

Signed-off-by: Erez Zadok [EMAIL PROTECTED]
Signed-off-by: Josef 'Jeff' Sipek [EMAIL PROTECTED]
---
 fs/unionfs/inode.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index f946b33..a86da5b 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -217,6 +217,11 @@ out:
return err;
 }
 
+/*
+ * unionfs_lookup is the only special function which takes a dentry, yet we
+ * do NOT want to call __unionfs_d_revalidate_chain because by definition,
+ * we don't have a valid dentry here yet.
+ */
 static struct dentry *unionfs_lookup(struct inode *parent,
 struct dentry *dentry,
 struct nameidata *nd)
-- 
1.5.2.2.238.g7cbf2f2

-
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 5/5] Unionfs: Remove unnecessary BUG_ON in unionfs_follow_link

2007-06-29 Thread Josef 'Jeff' Sipek
From: Erez Zadok [EMAIL PROTECTED]

Signed-off-by: Erez Zadok [EMAIL PROTECTED]
Signed-off-by: Josef 'Jeff' Sipek [EMAIL PROTECTED]
---
 fs/unionfs/inode.c |   30 --
 1 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index a86da5b..b5f9022 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -832,35 +832,21 @@ out:
 }
 
 /*
- * Check if dentry is valid or not, as per our generation numbers.
- * @dentry: dentry to check.
- * Returns 1 (valid) or 0 (invalid/stale).
+ * unionfs_follow_link takes a dentry, but it is simple.  It only needs to
+ * allocate some memory and then call our -readlink method.  Our
+ * unionfs_readlink *does* lock our dentry and revalidate the dentry.
+ * Therefore, we do not have to lock our dentry here, to prevent a deadlock;
+ * nor do we need to revalidate it either.  It is safe to not lock our
+ * dentry here, nor revalidate it, because unionfs_follow_link does not do
+ * anything (prior to calling -readlink) which could become inconsistent
+ * due to branch management.
  */
-static inline int is_valid_dentry(struct dentry *dentry)
-{
-   BUG_ON(!UNIONFS_D(dentry));
-   BUG_ON(!UNIONFS_SB(dentry-d_sb));
-   return (atomic_read(UNIONFS_D(dentry)-generation) ==
-   atomic_read(UNIONFS_SB(dentry-d_sb)-generation));
-}
-
-/* We don't lock the dentry here, because readlink does the heavy lifting. */
 static void *unionfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
char *buf;
int len = PAGE_SIZE, err;
mm_segment_t old_fs;
 
-   /*
-* FIXME: Really nasty...we can get called from two distinct places:
-* 1) read_link - locks the dentry
-* 2) VFS lookup code - does NOT lock the dentry
-*
-* The proper thing would be to call dentry revalidate. It however
-* expects a locked dentry, and we can't cleanly guarantee that.
-*/
-   BUG_ON(!is_valid_dentry(dentry));
-
unionfs_read_lock(dentry-d_sb);
 
/* This is freed by the put_link method assuming a successful call. */
-- 
1.5.2.2.238.g7cbf2f2

-
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/5] Unionfs: Add missing unlock call in unionfs_file_release

2007-06-29 Thread Josef 'Jeff' Sipek
Signed-off-by: Josef 'Jeff' Sipek [EMAIL PROTECTED]
---
 fs/unionfs/commonfops.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 6d87426..8527ac6 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -559,7 +559,7 @@ int unionfs_file_release(struct inode *inode, struct file 
*file)
 * support.
 */
if ((err = unionfs_file_revalidate(file, 1)))
-   return err;
+   goto out;
fileinfo = UNIONFS_F(file);
BUG_ON(file-f_dentry-d_inode != inode);
inodeinfo = UNIONFS_I(inode);
@@ -596,7 +596,9 @@ int unionfs_file_release(struct inode *inode, struct file 
*file)
fileinfo-rdstate = NULL;
}
kfree(fileinfo);
-   return 0;
+out:
+   unionfs_read_unlock(sb);
+   return err;
 }
 
 /* pass the ioctl to the lower fs */
-- 
1.5.2.2.238.g7cbf2f2

-
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 0/6][TAKE5] fallocate system call

2007-06-29 Thread Theodore Tso
On Thu, Jun 28, 2007 at 11:33:42AM -0700, Andrew Morton wrote:
  Please let us know what you think of Mingming's suggestion of posting
  all the fallocate patches including the ext4 ones as incremental ones
  against the -mm.
 
 I think Mingming was asking that Ted move the current quilt tree into git,
 presumably because she's working off git.

No, mingming and I both work off of the patch queue (which is also
stored in git).  So what mingming was asking for exactly was just
posting the incremental patches and tagging them appropriately to
avoid confusion.

I tried building the patch queue earlier in the week and it there were
multiple oops/panics as I ran things through various regression tests,
but that may have been fixed since (the tree was broken over the
weekend and I may have grabbed a broken patch series) or it may have
been a screw up on my part feeding them into our testing grid.  I
haven't had time to try again this week, but I'll try to put together
a new tested ext4 patchset over the weekend.

 I'm not sure what to do, really.  The core kernel patches need to be in
 Ted's tree for testing but that'll create a mess for me.

I don't think we have a problem here.  What we have now is fine, and
it was just people kvetching that Amit reposted patches that were
already in -mm and ext4.

In any case, the plan is to push all of the core bits into Linus tree
for 2.6.22 once it opens up, which should be Real Soon Now, it looks
like.

- Ted
-
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 0/6][TAKE5] fallocate system call

2007-06-29 Thread Jeff Garzik

Theodore Tso wrote:

I don't think we have a problem here.  What we have now is fine, and


It's fine for ext4, but not the wider world.  This is a common problem 
created by parallel development when code dependencies exist.




In any case, the plan is to push all of the core bits into Linus tree
for 2.6.22 once it opens up, which should be Real Soon Now, it looks
like.


Presumably you mean 2.6.23.

Jeff



-
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 0/6][TAKE5] fallocate system call

2007-06-29 Thread Mingming Caoc

Theodore Tso wrote:

On Thu, Jun 28, 2007 at 11:33:42AM -0700, Andrew Morton wrote:
  

Please let us know what you think of Mingming's suggestion of posting
all the fallocate patches including the ext4 ones as incremental ones
against the -mm.
  

I think Mingming was asking that Ted move the current quilt tree into git,
presumably because she's working off git.



No, mingming and I both work off of the patch queue (which is also
stored in git).  So what mingming was asking for exactly was just
posting the incremental patches and tagging them appropriately to
avoid confusion.

I tried building the patch queue earlier in the week and it there were
multiple oops/panics as I ran things through various regression tests,but that 
may have been fixed since (the tree was broken over the
weekend and I may have grabbed a broken patch series) or it may have
been a screw up on my part feeding them into our testing grid.  I
haven't had time to try again this week, but I'll try to put together
a new tested ext4 patchset over the weekend.

  
I think the ext4 patch queue is in good shape now.  Shaggy have tested 
in on dbench, fsx, and tiobench, tests runs fine. and BULL team has 
benchmarked  the latest ext4 patch queue with iozone and FFSB.


Regards,
Mingming

I'm not sure what to do, really.  The core kernel patches need to be in
Ted's tree for testing but that'll create a mess for me.



I don't think we have a problem here.  What we have now is fine, and
it was just people kvetching that Amit reposted patches that were
already in -mm and ext4.

In any case, the plan is to push all of the core bits into Linus tree
for 2.6.22 once it opens up, which should be Real Soon Now, it looks
like.

- Ted
-
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
  



-
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 0/6][TAKE5] fallocate system call

2007-06-29 Thread Theodore Tso
On Fri, Jun 29, 2007 at 10:29:21AM -0400, Jeff Garzik wrote:
 In any case, the plan is to push all of the core bits into Linus tree
 for 2.6.22 once it opens up, which should be Real Soon Now, it looks
 like.
 
 Presumably you mean 2.6.23.

Yes, sorry.  I meant once Linus releases 2.6.22, and we would be
aiming to merge before the 2.6.23-rc1 window.

- Ted
-
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 4/6] locks: fix locks.c lease symbol exports

2007-06-29 Thread J. Bruce Fields
From: J. Bruce Fields [EMAIL PROTECTED]

Bring lease exports into line with conventions for posix locks:
setlease() should be exported so filesystems can use it to implement
their lease methods.
vfs_setlease() need only be GPL-exported since only nfsd
needs it.

Signed-off-by: J. Bruce Fields [EMAIL PROTECTED]
---
 fs/locks.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index c06a002..ac267af 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1427,6 +1427,8 @@ out:
return error;
 }
 
+EXPORT_SYMBOL(setlease);
+
  /**
  * vfs_setlease-   sets a lease on an open file
  * @filp: file pointer
@@ -1451,7 +1453,7 @@ int vfs_setlease(struct file *filp, long arg, struct 
file_lock **lease)
return error;
 }
 
-EXPORT_SYMBOL(vfs_setlease);
+EXPORT_SYMBOL_GPL(vfs_setlease);
 
 /**
  * fcntl_setlease  -   sets a lease on an open file
-- 
1.5.2.58.g98ee

-
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


vfs lease api

2007-06-29 Thread J. Bruce Fields
Eventually we want to be able to support NFSv4 delegations for cluster
filesystem exports.  We implement NFSv4 delegations using leases.  So to
make this work, we need leases to be passed down to the filesystem, so
that a cluster filesystem can enforce leases correctly across all nodes.

The following patches do some minor cleanup of the lease code, and then
add a setlease() file method.

For now the only implementations of setlease() we include (for NFS and
GFS2) are used only to turn off leases selectively.  To complete this
work we'll need to implement proper lease support for GFS2 or OCFS2, and
probably do some more work on lease breaking.

But we're requesting this be included in -mm now in the theory that the
lease-disabling behavior is useful now anyway, and in hopes that this
will the required further work.

I'm also keeping this in the for-mm branch at:

git://linux-nfs.org/~bfields/linux.git for-mm 

(And maybe you could also remove the server-cluster-locking-api branch
from your list of git fetches, if it's still there?--I don't intend to
use it any more.)

--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


[PATCH 3/6] locks: rename lease functions to reflect locks.c conventions

2007-06-29 Thread J. Bruce Fields
From: J. Bruce Fields [EMAIL PROTECTED]

We've been using the convention that vfs_foo is the function that calls
a filesystem-specific foo method if it exists, or falls back on a
generic method if it doesn't.

So rename setlease to vfs_setlease, and __setlease to setlease.  Keep
setlease exported to allow filesystems to use the generic method in
addition to doing their own bookkeeping.

Signed-off-by: J. Bruce Fields [EMAIL PROTECTED]
---
 fs/locks.c  |   14 +++---
 fs/nfsd/nfs4state.c |   10 +-
 include/linux/fs.h  |1 +
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 8fa4420..c06a002 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1329,7 +1329,7 @@ int fcntl_getlease(struct file *filp)
 }
 
 /**
- * __setlease  -   sets a lease on an open file
+ * setlease-   sets a lease on an open file
  * @filp: file pointer
  * @arg: type of lease to obtain
  * @flp: input - file_lock to use, output - file_lock inserted
@@ -1339,7 +1339,7 @@ int fcntl_getlease(struct file *filp)
  *
  * Called with kernel lock held.
  */
-static int __setlease(struct file *filp, long arg, struct file_lock **flp)
+int setlease(struct file *filp, long arg, struct file_lock **flp)
 {
struct file_lock *fl, **before, **my_before = NULL, *lease;
struct dentry *dentry = filp-f_path.dentry;
@@ -1428,7 +1428,7 @@ out:
 }
 
  /**
- * setlease-   sets a lease on an open file
+ * vfs_setlease-   sets a lease on an open file
  * @filp: file pointer
  * @arg: type of lease to obtain
  * @lease: file_lock to use
@@ -1437,7 +1437,7 @@ out:
  * The fl_lmops fl_break function is required by break_lease
  */
 
-int setlease(struct file *filp, long arg, struct file_lock **lease)
+int vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
 {
int error;
 
@@ -1445,13 +1445,13 @@ int setlease(struct file *filp, long arg, struct 
file_lock **lease)
if (filp-f_op  filp-f_op-setlease)
error = filp-f_op-setlease(filp, arg, lease);
 else
-   error = __setlease(filp, arg, lease);
+   error = setlease(filp, arg, lease);
unlock_kernel();
 
return error;
 }
 
-EXPORT_SYMBOL(setlease);
+EXPORT_SYMBOL(vfs_setlease);
 
 /**
  * fcntl_setlease  -   sets a lease on an open file
@@ -1477,7 +1477,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, 
long arg)
 
lock_kernel();
 
-   error = setlease(filp, arg, flp);
+   error = vfs_setlease(filp, arg, flp);
if (error || arg == F_UNLCK)
goto out_unlock;
 
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 3cc8ce4..ed01a77 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -251,7 +251,7 @@ nfs4_close_delegation(struct nfs4_delegation *dp)
/* The following nfsd_close may not actually close the file,
 * but we want to remove the lease in any case. */
if (dp-dl_flock)
-   setlease(filp, F_UNLCK, dp-dl_flock);
+   vfs_setlease(filp, F_UNLCK, dp-dl_flock);
nfsd_close(filp);
 }
 
@@ -1396,7 +1396,7 @@ void nfsd_release_deleg_cb(struct file_lock *fl)
 /*
  * Set the delegation file_lock back pointer.
  *
- * Called from __setlease() with lock_kernel() held.
+ * Called from setlease() with lock_kernel() held.
  */
 static
 void nfsd_copy_lock_deleg_cb(struct file_lock *new, struct file_lock *fl)
@@ -1410,7 +1410,7 @@ void nfsd_copy_lock_deleg_cb(struct file_lock *new, 
struct file_lock *fl)
 }
 
 /*
- * Called from __setlease() with lock_kernel() held
+ * Called from setlease() with lock_kernel() held
  */
 static
 int nfsd_same_client_deleg_cb(struct file_lock *onlist, struct file_lock *try)
@@ -1710,10 +1710,10 @@ nfs4_open_delegation(struct svc_fh *fh, struct 
nfsd4_open *open, struct nfs4_sta
fl.fl_file = stp-st_vfs_file;
fl.fl_pid = current-tgid;
 
-   /* setlease checks to see if delegation should be handed out.
+   /* vfs_setlease checks to see if delegation should be handed out.
 * the lock_manager callbacks fl_mylease and fl_change are used
 */
-   if ((status = setlease(stp-st_vfs_file,
+   if ((status = vfs_setlease(stp-st_vfs_file,
flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK, flp))) {
dprintk(NFSD: setlease failed [%d], no delegation\n, status);
unhash_delegation(dp);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4fbbc7f..a26b52d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -866,6 +866,7 @@ extern int flock_lock_file_wait(struct file *filp, struct 
file_lock *fl);
 extern int __break_lease(struct inode *inode, unsigned int flags);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
 extern int setlease(struct file *, long, struct file_lock **);
+extern int vfs_setlease(struct 

[PATCH 5/6] gfs2: stop giving out non-cluster-coherent leases

2007-06-29 Thread J. Bruce Fields
From: Marc Eshel [EMAIL PROTECTED]

Since gfs2 can't prevent conflicting opens or leases on other nodes, we
probably shouldn't allow it to give out leases at all.

Put the newly defined lease operation into use in gfs2 by turning off
lease, unless we're using the nolock' locking module (in which case all
locking is local anyway).

Signed-off-by: Marc Eshel [EMAIL PROTECTED]
Signed-off-by: J. Bruce Fields [EMAIL PROTECTED]
Cc: Steven Whitehouse [EMAIL PROTECTED]
---
 fs/gfs2/ops_file.c |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 064df88..e34d9bd 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -489,6 +489,31 @@ static int gfs2_fsync(struct file *file, struct dentry 
*dentry, int datasync)
 }
 
 /**
+ * gfs2_setlease - acquire/release a file lease
+ * @file: the file pointer
+ * @arg: lease type
+ * @fl: file lock
+ *
+ * Returns: errno
+ */
+
+static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
+{
+   struct gfs2_sbd *sdp = GFS2_SB(file-f_mapping-host);
+   int ret = -EOPNOTSUPP;
+
+   if (sdp-sd_args.ar_localflocks) {
+   return setlease(file, arg, fl);
+   }
+
+   /* For now fail the delegation request. Cluster file system can not
+  allow any node in the cluster to get a local lease until it can
+  be managed centrally by the cluster file system.
+   */
+   return ret;
+}
+
+/**
  * gfs2_lock - acquire/release a posix lock on a file
  * @file: the file pointer
  * @cmd: either modify or retrieve lock state, possibly wait
@@ -639,6 +664,7 @@ const struct file_operations gfs2_file_fops = {
.flock  = gfs2_flock,
.splice_read= generic_file_splice_read,
.splice_write   = generic_file_splice_write,
+   .setlease   = gfs2_setlease,
 };
 
 const struct file_operations gfs2_dir_fops = {
-- 
1.5.2.58.g98ee

-
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 6/6] nfs: disable leases over NFS

2007-06-29 Thread J. Bruce Fields
From: J. Bruce Fields [EMAIL PROTECTED]

As Peter Staubach says elsewhere
(http://marc.info/?l=linux-kernelm=118113649526444w=2):

 The problem is that some file system such as NFSv2 and NFSv3 do
 not have sufficient support to be able to support leases correctly.
 In particular for these two file systems, there is no over the wire
 protocol support.

 Currently, these two file systems fail the fcntl(F_SETLEASE) call
 accidentally, due to a reference counting difference.  These file
 systems should fail more consciously, with a proper error to
 indicate that the call is invalid for them.

Define an nfs setlease method that just returns -EOPNOTSUPP.

If someone can demonstrate a real need, perhaps we could reenable
them in the presence of the nolock mount option.

Signed-off-by: J. Bruce Fields [EMAIL PROTECTED]
Cc: Peter Staubach [EMAIL PROTECTED]
Cc: Trond Myklebust [EMAIL PROTECTED]
---
 fs/nfs/file.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 9eb8eb4..97c1a3d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -51,6 +51,7 @@ static int  nfs_fsync(struct file *, struct dentry *dentry, 
int datasync);
 static int nfs_check_flags(int flags);
 static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl);
 static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl);
+static int nfs_setlease(struct file *file, long arg, struct file_lock **fl);
 
 const struct file_operations nfs_file_operations = {
.llseek = nfs_file_llseek,
@@ -67,6 +68,7 @@ const struct file_operations nfs_file_operations = {
.flock  = nfs_flock,
.sendfile   = nfs_file_sendfile,
.check_flags= nfs_check_flags,
+   .setlease   = nfs_setlease,
 };
 
 const struct inode_operations nfs_file_inode_operations = {
@@ -555,3 +557,8 @@ static int nfs_flock(struct file *filp, int cmd, struct 
file_lock *fl)
return do_unlk(filp, cmd, fl);
return do_setlk(filp, cmd, fl);
 }
+
+static int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
+{
+   return -EOPNOTSUPP;
+}
-- 
1.5.2.58.g98ee

-
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/6] locks: provide a file lease method enabling cluster-coherent leases

2007-06-29 Thread J. Bruce Fields
From: J. Bruce Fields [EMAIL PROTECTED]

Currently leases are only kept locally, so there's no way for a distributed
filesystem to enforce them against multiple clients.  We're particularly
interested in the case of nfsd exporting a cluster filesystem, in which
case nfsd needs cluster-coherent leases in order to implement delegations
correctly.

Signed-off-by: J. Bruce Fields [EMAIL PROTECTED]
---
 fs/locks.c |7 +--
 include/linux/fs.h |1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 6ad3c7b..8fa4420 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1442,7 +1442,10 @@ int setlease(struct file *filp, long arg, struct 
file_lock **lease)
int error;
 
lock_kernel();
-   error = __setlease(filp, arg, lease);
+   if (filp-f_op  filp-f_op-setlease)
+   error = filp-f_op-setlease(filp, arg, lease);
+else
+   error = __setlease(filp, arg, lease);
unlock_kernel();
 
return error;
@@ -1474,7 +1477,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, 
long arg)
 
lock_kernel();
 
-   error = __setlease(filp, arg, flp);
+   error = setlease(filp, arg, flp);
if (error || arg == F_UNLCK)
goto out_unlock;
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6a41f4c..4fbbc7f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1113,6 +1113,7 @@ struct file_operations {
int (*flock) (struct file *, int, struct file_lock *);
ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t 
*, size_t, unsigned int);
ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info 
*, size_t, unsigned int);
+   int (*setlease)(struct file *, long, struct file_lock **);
 };
 
 struct inode_operations {
-- 
1.5.2.58.g98ee

-
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 0/6][TAKE5] fallocate system call

2007-06-29 Thread Andrew Morton
On Fri, 29 Jun 2007 11:50:04 -0400
Mingming Caoc [EMAIL PROTECTED] wrote:

 I think the ext4 patch queue is in good shape now.

Which ext4 patches are you intending to merge into 2.6.23?

Please send all those out to lkml for review?
-
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 6/6] nfs: disable leases over NFS

2007-06-29 Thread Peter Staubach

J. Bruce Fields wrote:

From: J. Bruce Fields [EMAIL PROTECTED]

As Peter Staubach says elsewhere
(http://marc.info/?l=linux-kernelm=118113649526444w=2):

  

The problem is that some file system such as NFSv2 and NFSv3 do
not have sufficient support to be able to support leases correctly.
In particular for these two file systems, there is no over the wire
protocol support.

Currently, these two file systems fail the fcntl(F_SETLEASE) call
accidentally, due to a reference counting difference.  These file
systems should fail more consciously, with a proper error to
indicate that the call is invalid for them.



Define an nfs setlease method that just returns -EOPNOTSUPP.

If someone can demonstrate a real need, perhaps we could reenable
them in the presence of the nolock mount option.

Signed-off-by: J. Bruce Fields [EMAIL PROTECTED]
Cc: Peter Staubach [EMAIL PROTECTED]
Cc: Trond Myklebust [EMAIL PROTECTED]
---
 fs/nfs/file.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 9eb8eb4..97c1a3d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -51,6 +51,7 @@ static int  nfs_fsync(struct file *, struct dentry *dentry, 
int datasync);
 static int nfs_check_flags(int flags);
 static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl);
 static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl);
+static int nfs_setlease(struct file *file, long arg, struct file_lock **fl);
 
 const struct file_operations nfs_file_operations = {

.llseek = nfs_file_llseek,
@@ -67,6 +68,7 @@ const struct file_operations nfs_file_operations = {
.flock  = nfs_flock,
.sendfile   = nfs_file_sendfile,
.check_flags= nfs_check_flags,
+   .setlease   = nfs_setlease,
 };
 
 const struct inode_operations nfs_file_inode_operations = {

@@ -555,3 +557,8 @@ static int nfs_flock(struct file *filp, int cmd, struct 
file_lock *fl)
return do_unlk(filp, cmd, fl);
return do_setlk(filp, cmd, fl);
 }
+
+static int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
+{
+   return -EOPNOTSUPP;
+}
  


A couple of things --

First, there is already some support to disable leases for NFS mounted
file systems in -mm, I think.  Are you planning on removing it?

Second, it seems to me that EINVAL would be a better error to return
than EOPNOTSUPP.  This is an invalid operation to apply to this file
and might match POSIX style specs better.

   Thanx...

  ps
-
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 6/6] nfs: disable leases over NFS

2007-06-29 Thread J. Bruce Fields
On Fri, Jun 29, 2007 at 05:16:19PM -0400, Peter Staubach wrote:
 First, there is already some support to disable leases for NFS mounted
 file systems in -mm, I think.

Oops, sorry; my fault for not checking -mm before sending

 Are you planning on removing it?

I'd rather do that, yes.  Any objection?

 Second, it seems to me that EINVAL would be a better error to return
 than EOPNOTSUPP.  This is an invalid operation to apply to this file
 and might match POSIX style specs better.

I'm not sure what you mean by might match POSIX style specs better?

From a quick check, other reasons we'd get EINVAL in this case:

- attempt to get a lease on something other than a regular file.
- leases disabled with /proc/sys/fs/leases-enable

So if the application calling fcntl knows it was calling it on a regular
file, then with your proposal an EINVAL return would mean leases were
disabled for one reason or another, and it could take that as a sign to
fall back on some other behavior.  And I can't see any reason it would
need to distinguish between those two remaining cases (filesystem
doesn't support leases, or leases are disabled by the sysctl).  So,
OK, EINVAL sounds fine to me.

But I don't have a really strong opinion.  I think the suggestion of
EOPNOTSUPP was from Steven Whitehouse; Steven, do you care?

--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


Re: [PATCH 6/6] nfs: disable leases over NFS

2007-06-29 Thread Steven Whitehouse
Hi,

On Fri, 2007-06-29 at 17:39 -0400, J. Bruce Fields wrote:
 On Fri, Jun 29, 2007 at 05:16:19PM -0400, Peter Staubach wrote:
  First, there is already some support to disable leases for NFS mounted
  file systems in -mm, I think.
 
 Oops, sorry; my fault for not checking -mm before sending
 
  Are you planning on removing it?
 
 I'd rather do that, yes.  Any objection?
 
  Second, it seems to me that EINVAL would be a better error to return
  than EOPNOTSUPP.  This is an invalid operation to apply to this file
  and might match POSIX style specs better.
 
 I'm not sure what you mean by might match POSIX style specs better?
 
 From a quick check, other reasons we'd get EINVAL in this case:
 
   - attempt to get a lease on something other than a regular file.
   - leases disabled with /proc/sys/fs/leases-enable
 
 So if the application calling fcntl knows it was calling it on a regular
 file, then with your proposal an EINVAL return would mean leases were
 disabled for one reason or another, and it could take that as a sign to
 fall back on some other behavior.  And I can't see any reason it would
 need to distinguish between those two remaining cases (filesystem
 doesn't support leases, or leases are disabled by the sysctl).  So,
 OK, EINVAL sounds fine to me.
 
 But I don't have a really strong opinion.  I think the suggestion of
 EOPNOTSUPP was from Steven Whitehouse; Steven, do you care?
 
 --b.

EINVAL is fine by me, just so long as its not EAGAIN then it gets my
blessing :-)

Steve.


-
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: DIO panic on 2.6.21.5

2007-06-29 Thread Zach Brown


On Jun 27, 2007, at 8:01 PM, Badari Pulavarty wrote:


Hi Zach,

One of our perf. team ran into this while doing some runs.
I didn't see anything obvious - it looks like we converted
async IO to synchronous one. I didn't spend much time digging
around.


It looks pretty bad, a *shouldn't happen* kind of case.  I'm sure it  
just means I missed some case :/.



Is this a known issue ? Any ideas ?


I haven't seen it before, no.  Do they have a reliable recipe to  
reproduce it?


In any case, I'll dig in early next week when I'm back from OLS.  I'm  
pretty confident that we'll be able to find the case.  Please let me  
know if it's urgent and I should try and find time before then.


Thanks for reporting it.

- z
-
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 6/6] nfs: disable leases over NFS

2007-06-29 Thread J. Bruce Fields
On Fri, Jun 29, 2007 at 11:30:27PM +0100, Steven Whitehouse wrote:
 EINVAL is fine by me, just so long as its not EAGAIN then it gets my
 blessing :-)

OK.  I've changed the error return, in both the NFS and GFS2 cases, did
some minor cleanup and commenting while I was at it, and pushed the
results out to for-mm:

git://linux-nfs.org/~bfields/linux.git for-mm

--b.

diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index e34d9bd..29a86fe 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -500,17 +500,15 @@ static int gfs2_fsync(struct file *file, struct dentry 
*dentry, int datasync)
 static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
 {
struct gfs2_sbd *sdp = GFS2_SB(file-f_mapping-host);
-   int ret = -EOPNOTSUPP;
 
-   if (sdp-sd_args.ar_localflocks) {
+   /*
+* We don't currently have a way to enforce a lease across the whole
+* cluster; until we do, disable leases (by just returning -EINVAL),
+* unless the administrator has requested purely local locking.
+*/
+   if (sdp-sd_args.ar_localflocks)
return setlease(file, arg, fl);
-   }
-
-   /* For now fail the delegation request. Cluster file system can not
-  allow any node in the cluster to get a local lease until it can
-  be managed centrally by the cluster file system.
-   */
-   return ret;
+   return -EINVAL;
 }
 
 /**
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 97c1a3d..d92a383 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -560,5 +560,10 @@ static int nfs_flock(struct file *filp, int cmd, struct 
file_lock *fl)
 
 static int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
 {
-   return -EOPNOTSUPP;
+   /*
+* There is no protocol support for leases, so we have no way
+* to implement them correctly in the face of opens by other
+* clients.
+*/
+   return -EINVAL;
 }
-
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