aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-06-23 05:05:12 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:43:02 -0400
commit75e1fcc0b18df0a65ab113198e9dc0e98999a08c (patch)
tree3ac0d0d3120cbca4ee9734494e2c9a4e0775ac4f /fs
parentff7b86b82083f24b8637dff1528c7101c18c7f39 (diff)
[PATCH] vfs: add lock owner argument to flush operation
Pass the POSIX lock owner ID to the flush operation. This is useful for filesystems which don't want to store any locking state in inode->i_flock but want to handle locking/unlocking POSIX locks internally. FUSE is one such filesystem but I think it possible that some network filesystems would need this also. Also add a flag to indicate that a POSIX locking request was generated by close(), so filesystems using the above feature won't send an extra locking request in this case. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/file.c2
-rw-r--r--fs/coda/file.c2
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/locks.c2
-rw-r--r--fs/nfs/file.c4
-rw-r--r--fs/open.c2
7 files changed, 8 insertions, 8 deletions
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index c98755dca868..d56c0577c710 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -74,7 +74,7 @@ extern ssize_t cifs_user_write(struct file *file, const char __user *write_data,
74 size_t write_size, loff_t * poffset); 74 size_t write_size, loff_t * poffset);
75extern int cifs_lock(struct file *, int, struct file_lock *); 75extern int cifs_lock(struct file *, int, struct file_lock *);
76extern int cifs_fsync(struct file *, struct dentry *, int); 76extern int cifs_fsync(struct file *, struct dentry *, int);
77extern int cifs_flush(struct file *); 77extern int cifs_flush(struct file *, fl_owner_t id);
78extern int cifs_file_mmap(struct file * , struct vm_area_struct *); 78extern int cifs_file_mmap(struct file * , struct vm_area_struct *);
79extern const struct file_operations cifs_dir_ops; 79extern const struct file_operations cifs_dir_ops;
80extern int cifs_dir_open(struct inode *inode, struct file *file); 80extern int cifs_dir_open(struct inode *inode, struct file *file);
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 487ea8b3baaa..b4a18c1cab0a 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1417,7 +1417,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1417 * As file closes, flush all cached write data for this inode checking 1417 * As file closes, flush all cached write data for this inode checking
1418 * for write behind errors. 1418 * for write behind errors.
1419 */ 1419 */
1420int cifs_flush(struct file *file) 1420int cifs_flush(struct file *file, fl_owner_t id)
1421{ 1421{
1422 struct inode * inode = file->f_dentry->d_inode; 1422 struct inode * inode = file->f_dentry->d_inode;
1423 int rc = 0; 1423 int rc = 0;
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 7c2642431fa5..cc66c681bd11 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -164,7 +164,7 @@ int coda_open(struct inode *coda_inode, struct file *coda_file)
164 return 0; 164 return 0;
165} 165}
166 166
167int coda_flush(struct file *coda_file) 167int coda_flush(struct file *coda_file, fl_owner_t id)
168{ 168{
169 unsigned short flags = coda_file->f_flags & ~O_EXCL; 169 unsigned short flags = coda_file->f_flags & ~O_EXCL;
170 unsigned short coda_flags = coda_flags_to_cflags(flags); 170 unsigned short coda_flags = coda_flags_to_cflags(flags);
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index fc342cf7c2cc..087f3b734f40 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -169,7 +169,7 @@ static int fuse_release(struct inode *inode, struct file *file)
169 return fuse_release_common(inode, file, 0); 169 return fuse_release_common(inode, file, 0);
170} 170}
171 171
172static int fuse_flush(struct file *file) 172static int fuse_flush(struct file *file, fl_owner_t id)
173{ 173{
174 struct inode *inode = file->f_dentry->d_inode; 174 struct inode *inode = file->f_dentry->d_inode;
175 struct fuse_conn *fc = get_fuse_conn(inode); 175 struct fuse_conn *fc = get_fuse_conn(inode);
diff --git a/fs/locks.c b/fs/locks.c
index e588e1c265f7..f8a634ac1121 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1907,7 +1907,7 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner)
1907 return; 1907 return;
1908 1908
1909 lock.fl_type = F_UNLCK; 1909 lock.fl_type = F_UNLCK;
1910 lock.fl_flags = FL_POSIX; 1910 lock.fl_flags = FL_POSIX | FL_CLOSE;
1911 lock.fl_start = 0; 1911 lock.fl_start = 0;
1912 lock.fl_end = OFFSET_MAX; 1912 lock.fl_end = OFFSET_MAX;
1913 lock.fl_owner = owner; 1913 lock.fl_owner = owner;
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index fade02c15e6e..fa05c027ea11 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -43,7 +43,7 @@ static int nfs_file_mmap(struct file *, struct vm_area_struct *);
43static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); 43static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *);
44static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t); 44static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t);
45static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t); 45static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t);
46static int nfs_file_flush(struct file *); 46static int nfs_file_flush(struct file *, fl_owner_t id);
47static int nfs_fsync(struct file *, struct dentry *dentry, int datasync); 47static int nfs_fsync(struct file *, struct dentry *dentry, int datasync);
48static int nfs_check_flags(int flags); 48static int nfs_check_flags(int flags);
49static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl); 49static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl);
@@ -188,7 +188,7 @@ static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
188 * 188 *
189 */ 189 */
190static int 190static int
191nfs_file_flush(struct file *file) 191nfs_file_flush(struct file *file, fl_owner_t id)
192{ 192{
193 struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; 193 struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data;
194 struct inode *inode = file->f_dentry->d_inode; 194 struct inode *inode = file->f_dentry->d_inode;
diff --git a/fs/open.c b/fs/open.c
index a37ff861108f..5fb16e5267dc 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1152,7 +1152,7 @@ int filp_close(struct file *filp, fl_owner_t id)
1152 } 1152 }
1153 1153
1154 if (filp->f_op && filp->f_op->flush) 1154 if (filp->f_op && filp->f_op->flush)
1155 retval = filp->f_op->flush(filp); 1155 retval = filp->f_op->flush(filp, id);
1156 1156
1157 dnotify_flush(filp, id); 1157 dnotify_flush(filp, id);
1158 locks_remove_posix(filp, id); 1158 locks_remove_posix(filp, id);