We modified setlease to require the caller to allocate the new lease in
the case of creating a new lease, but forgot to fix up the filesystem
methods.
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Steve French <sfrench@samba.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
knows that the file won't be changed on the server
by anyone else */
return generic_setlease(file, arg, lease);
knows that the file won't be changed on the server
by anyone else */
return generic_setlease(file, arg, lease);
+ else {
+ if (arg != F_UNLCK)
+ locks_free_lock(*lease);
}
struct file_system_type cifs_fs_type = {
}
struct file_system_type cifs_fs_type = {
static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
{
static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
{
+ if (arg != F_UNLCK)
+ locks_free_lock(*fl);
EXPORT_SYMBOL_GPL(locks_release_private);
/* Free a lock which is not in use. */
EXPORT_SYMBOL_GPL(locks_release_private);
/* Free a lock which is not in use. */
-static void locks_free_lock(struct file_lock *fl)
+void locks_free_lock(struct file_lock *fl)
{
BUG_ON(waitqueue_active(&fl->fl_wait));
BUG_ON(!list_empty(&fl->fl_block));
{
BUG_ON(waitqueue_active(&fl->fl_wait));
BUG_ON(!list_empty(&fl->fl_block));
locks_release_private(fl);
kmem_cache_free(filelock_cache, fl);
}
locks_release_private(fl);
kmem_cache_free(filelock_cache, fl);
}
+EXPORT_SYMBOL(locks_free_lock);
void locks_init_lock(struct file_lock *fl)
{
void locks_init_lock(struct file_lock *fl)
{
dprintk("NFS: setlease(%s/%s, arg=%ld)\n",
file->f_path.dentry->d_parent->d_name.name,
file->f_path.dentry->d_name.name, arg);
dprintk("NFS: setlease(%s/%s, arg=%ld)\n",
file->f_path.dentry->d_parent->d_name.name,
file->f_path.dentry->d_name.name, arg);
+ if (arg != F_UNLCK)
+ locks_free_lock(*fl);
extern int fcntl_getlease(struct file *filp);
/* fs/locks.c */
extern int fcntl_getlease(struct file *filp);
/* fs/locks.c */
+void locks_free_lock(struct file_lock *fl);
extern void locks_init_lock(struct file_lock *);
extern struct file_lock * locks_alloc_lock(void);
extern void locks_copy_lock(struct file_lock *, struct file_lock *);
extern void locks_init_lock(struct file_lock *);
extern struct file_lock * locks_alloc_lock(void);
extern void locks_copy_lock(struct file_lock *, struct file_lock *);