an MDS multiple times. Upon recovery the MDS would detect this
and fail during startup. Handle this more gracefully.
+Severity : enhancement
+Bugzilla : 11563
+Description: Add -o localflock option to simulate old noflock
+behaviour.
+Details : This will achieve local-only flock/fcntl locks
+ coherentness.
+
+
--------------------------------------------------------------------------------
2007-05-03 Cluster File Systems, Inc. <info@clusterfs.com>
}
#endif
+/* -o localflock - only provides locally consistent flock locks */
struct file_operations ll_file_operations = {
.read = ll_file_read,
.write = ll_file_write,
.sendfile = ll_file_sendfile,
#endif
.fsync = ll_fsync,
-#ifdef HAVE_F_OP_FLOCK
- .flock = ll_file_noflock,
-#endif
- .lock = ll_file_noflock
};
struct file_operations ll_file_operations_flock = {
.lock = ll_file_flock
};
+/* These are for -o noflock - to return ENOSYS on flock calls */
+struct file_operations ll_file_operations_noflock = {
+ .read = ll_file_read,
+ .write = ll_file_write,
+ .ioctl = ll_file_ioctl,
+ .open = ll_file_open,
+ .release = ll_file_release,
+ .mmap = ll_file_mmap,
+ .llseek = ll_file_seek,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+ .sendfile = ll_file_sendfile,
+#endif
+ .fsync = ll_fsync,
+#ifdef HAVE_F_OP_FLOCK
+ .flock = ll_file_noflock,
+#endif
+ .lock = ll_file_noflock
+};
struct inode_operations ll_file_inode_operations = {
#ifdef LUSTRE_KERNEL_VERSION
#define LL_SBI_USER_XATTR 0x08 /* support user xattr */
#define LL_SBI_ACL 0x10 /* support ACL */
#define LL_SBI_JOIN 0x20 /* support JOIN */
+#define LL_SBI_LOCALFLOCK 0x40 /* Local flocks support by kernel */
struct ll_sb_info {
struct list_head ll_list;
/* llite/file.c */
extern struct file_operations ll_file_operations;
extern struct file_operations ll_file_operations_flock;
+extern struct file_operations ll_file_operations_noflock;
extern struct inode_operations ll_file_inode_operations;
extern int ll_inode_revalidate_it(struct dentry *, struct lookup_intent *);
extern int ll_have_md_lock(struct inode *inode, __u64 bits);
if (sbi->ll_flags & LL_SBI_FLOCK)
sbi->ll_fop = &ll_file_operations_flock;
- else
+ else if (sbi->ll_flags & LL_SBI_LOCALFLOCK)
sbi->ll_fop = &ll_file_operations;
+ else
+ sbi->ll_fop = &ll_file_operations_noflock;
err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, data);
if (err == -EBUSY) {
*flags |= tmp;
goto next;
}
- tmp = ll_set_opt("noflock", s1, LL_SBI_FLOCK);
+ tmp = ll_set_opt("localflock", s1, LL_SBI_LOCALFLOCK);
+ if (tmp) {
+ *flags |= tmp;
+ goto next;
+ }
+ tmp = ll_set_opt("noflock", s1, LL_SBI_FLOCK|LL_SBI_LOCALFLOCK);
if (tmp) {
*flags &= ~tmp;
goto next;