|
@@ -43,6 +43,7 @@
|
|
|
#include <linux/init.h>
|
|
|
#include <linux/string.h>
|
|
|
#include <linux/backing-dev.h>
|
|
|
+#include <linux/poll.h>
|
|
|
|
|
|
#include <asm/uaccess.h>
|
|
|
|
|
@@ -98,8 +99,12 @@ static const struct dlm_protocol_version user_locking_protocol = {
|
|
|
* The ABI features are local to this machine's dlmfs mount. This is
|
|
|
* distinct from the locking protocol, which is concerned with inter-node
|
|
|
* interaction.
|
|
|
+ *
|
|
|
+ * Capabilities:
|
|
|
+ * - bast : POLLIN against the file descriptor of a held lock
|
|
|
+ * signifies a bast fired on the lock.
|
|
|
*/
|
|
|
-#define DLMFS_CAPABILITIES ""
|
|
|
+#define DLMFS_CAPABILITIES "bast"
|
|
|
extern int param_set_dlmfs_capabilities(const char *val,
|
|
|
struct kernel_param *kp)
|
|
|
{
|
|
@@ -215,6 +220,22 @@ static int dlmfs_file_release(struct inode *inode,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static unsigned int dlmfs_file_poll(struct file *file, poll_table *wait)
|
|
|
+{
|
|
|
+ int event = 0;
|
|
|
+ struct inode *inode = file->f_path.dentry->d_inode;
|
|
|
+ struct dlmfs_inode_private *ip = DLMFS_I(inode);
|
|
|
+
|
|
|
+ poll_wait(file, &ip->ip_lockres.l_event, wait);
|
|
|
+
|
|
|
+ spin_lock(&ip->ip_lockres.l_lock);
|
|
|
+ if (ip->ip_lockres.l_flags & USER_LOCK_BLOCKED)
|
|
|
+ event = POLLIN | POLLRDNORM;
|
|
|
+ spin_unlock(&ip->ip_lockres.l_lock);
|
|
|
+
|
|
|
+ return event;
|
|
|
+}
|
|
|
+
|
|
|
static ssize_t dlmfs_file_read(struct file *filp,
|
|
|
char __user *buf,
|
|
|
size_t count,
|
|
@@ -585,6 +606,7 @@ static int dlmfs_fill_super(struct super_block * sb,
|
|
|
static const struct file_operations dlmfs_file_operations = {
|
|
|
.open = dlmfs_file_open,
|
|
|
.release = dlmfs_file_release,
|
|
|
+ .poll = dlmfs_file_poll,
|
|
|
.read = dlmfs_file_read,
|
|
|
.write = dlmfs_file_write,
|
|
|
};
|