]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - fs/aufs/poll.c
UBUNTU: ubuntu: vbox -- update to 5.2.6-dfsg-5
[mirror_ubuntu-bionic-kernel.git] / fs / aufs / poll.c
CommitLineData
0006ebb4
SF
1/*
2 * Copyright (C) 2005-2017 Junjiro R. Okajima
3 *
4 * This program, aufs is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * poll operation
20 * There is only one filesystem which implements ->poll operation, currently.
21 */
22
23#include "aufs.h"
24
25unsigned int aufs_poll(struct file *file, poll_table *wait)
26{
27 unsigned int mask;
28 int err;
29 struct file *h_file;
30 struct super_block *sb;
31
32 /* We should pretend an error happened. */
33 mask = POLLERR /* | POLLIN | POLLOUT */;
34 sb = file->f_path.dentry->d_sb;
35 si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
36
37 h_file = au_read_pre(file, /*keep_fi*/0, /*lsc*/0);
38 err = PTR_ERR(h_file);
39 if (IS_ERR(h_file))
40 goto out;
41
42 /* it is not an error if h_file has no operation */
43 mask = DEFAULT_POLLMASK;
44 if (h_file->f_op->poll)
45 mask = h_file->f_op->poll(h_file, wait);
46 fput(h_file); /* instead of au_read_post() */
47
48out:
49 si_read_unlock(sb);
50 AuTraceErr((int)mask);
51 return mask;
52}