]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] rename get_lease to break_lease
authorMatthew Wilcox <willy@debian.org>
Tue, 19 Nov 2002 15:07:34 +0000 (07:07 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 19 Nov 2002 15:07:34 +0000 (07:07 -0800)
Al pointed out that the current name of get_lease is extremely confusing
and I agree.

This (a) renames it to break_lease and (b) fixes a bug noticed by Dave
Hansen which could cause a NULL pointer dereference under high load.

fs/locks.c
fs/namei.c
fs/nfsd/vfs.c
fs/open.c
include/linux/fs.h
kernel/ksyms.c

index 8efbc74ec1b85ec5f6417261101f303b4efd7d99..d2b55e36a7da4b8f5ee2b9242a9dcd13780b774d 100644 (file)
@@ -994,16 +994,16 @@ static void time_out_leases(struct inode *inode)
 }
 
 /**
- *     __get_lease     -       revoke all outstanding leases on file
+ *     __break_lease   -       revoke all outstanding leases on file
  *     @inode: the inode of the file to return
  *     @mode: the open mode (read or write)
  *
- *     get_lease (inlined for speed) has checked there already
+ *     break_lease (inlined for speed) has checked there already
  *     is a lease on this file.  Leases are broken on a call to open()
  *     or truncate().  This function can sleep unless you
  *     specified %O_NONBLOCK to your open().
  */
-int __get_lease(struct inode *inode, unsigned int mode)
+int __break_lease(struct inode *inode, unsigned int mode)
 {
        int error = 0, future;
        struct file_lock *new_fl, *flock;
index b2dc8dffd6ca2d162bcb0fdd87e8707991f78372..28a517574b6626b9eb5a5844ce719ec787b5cb8f 100644 (file)
@@ -1183,7 +1183,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
        /*
         * Ensure there are no outstanding leases on the file.
         */
-       error = get_lease(inode, flag);
+       error = break_lease(inode, flag);
        if (error)
                return error;
 
index e706ce2ffd2d70f9e594679a5cb50d35d262975d..34486025974b1fa5329269e89a80b995b13b768d 100644 (file)
@@ -259,7 +259,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
                 * If we are changing the size of the file, then
                 * we need to break all leases.
                 */
-               err = get_lease(inode, FMODE_WRITE);
+               err = break_lease(inode, FMODE_WRITE);
                if (err)
                        goto out_nfserr;
 
@@ -453,7 +453,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
         * Check to see if there are any leases on this file.
         * This may block while leases are broken.
         */
-       err = get_lease(inode, (access & MAY_WRITE) ? FMODE_WRITE : 0);
+       err = break_lease(inode, (access & MAY_WRITE) ? FMODE_WRITE : 0);
        if (err)
                goto out_nfserr;
 
index 6b01ca03d0179842bd4e051b7a30fa29061893a0..19f9cd53a861d09e83fc33c0b1f8b2045c7802c3 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -131,7 +131,7 @@ static inline long do_sys_truncate(const char * path, loff_t length)
        /*
         * Make sure that there are no leases.
         */
-       error = get_lease(inode, FMODE_WRITE);
+       error = break_lease(inode, FMODE_WRITE);
        if (error)
                goto dput_and_out;
 
index 400a5674083b660ec131030fbb98a9eba3e7d4e1..7aa6498d7d5dc711ff51e32031b3ccab30e65e04 100644 (file)
@@ -578,7 +578,7 @@ extern int posix_lock_file(struct file *, struct file_lock *);
 extern void posix_block_lock(struct file_lock *, struct file_lock *);
 extern void posix_unblock_lock(struct file *, struct file_lock *);
 extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
-extern int __get_lease(struct inode *inode, unsigned int flags);
+extern int __break_lease(struct inode *inode, unsigned int flags);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
 extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
 extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
@@ -1052,10 +1052,10 @@ static inline int locks_verify_truncate(struct inode *inode,
        return 0;
 }
 
-static inline int get_lease(struct inode *inode, unsigned int mode)
+static inline int break_lease(struct inode *inode, unsigned int mode)
 {
-       if (inode->i_flock && (inode->i_flock->fl_flags & FL_LEASE))
-               return __get_lease(inode, mode);
+       if (inode->i_flock)
+               return __break_lease(inode, mode);
        return 0;
 }
 
index c54fadff0c0d16063027885a0b4aede3a3d01ae4..c2f7e5bc4dde234cb4ba5b70dddef727a7174242 100644 (file)
@@ -287,7 +287,7 @@ EXPORT_SYMBOL(page_follow_link);
 EXPORT_SYMBOL(page_symlink_inode_operations);
 EXPORT_SYMBOL(page_symlink);
 EXPORT_SYMBOL(vfs_readdir);
-EXPORT_SYMBOL(__get_lease);
+EXPORT_SYMBOL(__break_lease);
 EXPORT_SYMBOL(lease_get_mtime);
 EXPORT_SYMBOL(lock_may_read);
 EXPORT_SYMBOL(lock_may_write);