Re: [PATCH] fuse: freezing abort when use wait_event_killable{,_exclusive}().

From: kbuild test robot
Date: Fri Dec 02 2016 - 09:44:38 EST


Hi cuilifei,

[auto build test ERROR on fuse/for-next]
[also build test ERROR on v4.9-rc7 next-20161202]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/cuilifei/fuse-freezing-abort-when-use-wait_event_killable-_exclusive/20161202-221508
base: https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next
config: i386-randconfig-i0-201648 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

fs/fuse/dev.c: In function '__fuse_get_req':
>> fs/fuse/dev.c:31:4: error: 'ret' undeclared (first use in this function)
ret = wait_event_interruptible_exclusive(wq, \
^
fs/fuse/dev.c:175:10: note: in expansion of macro 'wait_fatal_freezable'
intr = wait_fatal_freezable(fc->blocked_waitq,
^
fs/fuse/dev.c:31:4: note: each undeclared identifier is reported only once for each function it appears in
ret = wait_event_interruptible_exclusive(wq, \
^
fs/fuse/dev.c:175:10: note: in expansion of macro 'wait_fatal_freezable'
intr = wait_fatal_freezable(fc->blocked_waitq,
^
>> fs/fuse/dev.c:175:3: error: implicit declaration of function 'freezing' [-Werror=implicit-function-declaration]
intr = wait_fatal_freezable(fc->blocked_waitq,
^
>> fs/fuse/dev.c:175:3: error: implicit declaration of function 'try_to_freeze' [-Werror=implicit-function-declaration]
fs/fuse/dev.c: In function 'request_wait_answer':
>> fs/fuse/dev.c:31:4: error: 'ret' undeclared (first use in this function)
ret = wait_event_interruptible_exclusive(wq, \
^
fs/fuse/dev.c:468:9: note: in expansion of macro 'wait_fatal_freezable'
err = wait_fatal_freezable(req->waitq,
^
cc1: some warnings being treated as errors

vim +/ret +31 fs/fuse/dev.c

25
26 #define wait_fatal_freezable(wq, condition, exclusive) \
27 ({ \
28 int __ret = 0; \
29 do { \
30 if (exclusive) \
> 31 ret = wait_event_interruptible_exclusive(wq, \
32 condition); \
33 else \
34 ret = wait_event_interruptible(wq, condition); \
35 if (!__ret || fatal_signal_pending(current)) \
36 break; \
37 if (!freezing(current)) \
38 continue; \
39 } while (try_to_freeze()); \
40 __ret; \
41 })
42
43 static struct kmem_cache *fuse_req_cachep;
44
45 static struct fuse_dev *fuse_get_dev(struct file *file)
46 {
47 /*
48 * Lockless access is OK, because file->private data is set
49 * once during mount and is valid until the file is released.
50 */
51 return ACCESS_ONCE(file->private_data);
52 }
53
54 static void fuse_request_init(struct fuse_req *req, struct page **pages,
55 struct fuse_page_desc *page_descs,
56 unsigned npages)
57 {
58 memset(req, 0, sizeof(*req));
59 memset(pages, 0, sizeof(*pages) * npages);
60 memset(page_descs, 0, sizeof(*page_descs) * npages);
61 INIT_LIST_HEAD(&req->list);
62 INIT_LIST_HEAD(&req->intr_entry);
63 init_waitqueue_head(&req->waitq);
64 atomic_set(&req->count, 1);
65 req->pages = pages;
66 req->page_descs = page_descs;
67 req->max_pages = npages;
68 __set_bit(FR_PENDING, &req->flags);
69 }
70
71 static struct fuse_req *__fuse_request_alloc(unsigned npages, gfp_t flags)
72 {
73 struct fuse_req *req = kmem_cache_alloc(fuse_req_cachep, flags);
74 if (req) {
75 struct page **pages;
76 struct fuse_page_desc *page_descs;
77
78 if (npages <= FUSE_REQ_INLINE_PAGES) {
79 pages = req->inline_pages;
80 page_descs = req->inline_page_descs;
81 } else {
82 pages = kmalloc(sizeof(struct page *) * npages, flags);
83 page_descs = kmalloc(sizeof(struct fuse_page_desc) *
84 npages, flags);
85 }
86
87 if (!pages || !page_descs) {
88 kfree(pages);
89 kfree(page_descs);
90 kmem_cache_free(fuse_req_cachep, req);
91 return NULL;
92 }
93
94 fuse_request_init(req, pages, page_descs, npages);
95 }
96 return req;
97 }
98
99 struct fuse_req *fuse_request_alloc(unsigned npages)
100 {
101 return __fuse_request_alloc(npages, GFP_KERNEL);
102 }
103 EXPORT_SYMBOL_GPL(fuse_request_alloc);
104
105 struct fuse_req *fuse_request_alloc_nofs(unsigned npages)
106 {
107 return __fuse_request_alloc(npages, GFP_NOFS);
108 }
109
110 void fuse_request_free(struct fuse_req *req)
111 {
112 if (req->pages != req->inline_pages) {
113 kfree(req->pages);
114 kfree(req->page_descs);
115 }
116 kmem_cache_free(fuse_req_cachep, req);
117 }
118
119 static void block_sigs(sigset_t *oldset)
120 {
121 sigset_t mask;
122
123 siginitsetinv(&mask, sigmask(SIGKILL));
124 sigprocmask(SIG_BLOCK, &mask, oldset);
125 }
126
127 static void restore_sigs(sigset_t *oldset)
128 {
129 sigprocmask(SIG_SETMASK, oldset, NULL);
130 }
131
132 void __fuse_get_request(struct fuse_req *req)
133 {
134 atomic_inc(&req->count);
135 }
136
137 /* Must be called with > 1 refcount */
138 static void __fuse_put_request(struct fuse_req *req)
139 {
140 BUG_ON(atomic_read(&req->count) < 2);
141 atomic_dec(&req->count);
142 }
143
144 static void fuse_req_init_context(struct fuse_req *req)
145 {
146 req->in.h.uid = from_kuid_munged(&init_user_ns, current_fsuid());
147 req->in.h.gid = from_kgid_munged(&init_user_ns, current_fsgid());
148 req->in.h.pid = current->pid;
149 }
150
151 void fuse_set_initialized(struct fuse_conn *fc)
152 {
153 /* Make sure stores before this are seen on another CPU */
154 smp_wmb();
155 fc->initialized = 1;
156 }
157
158 static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background)
159 {
160 return !fc->initialized || (for_background && fc->blocked);
161 }
162
163 static struct fuse_req *__fuse_get_req(struct fuse_conn *fc, unsigned npages,
164 bool for_background)
165 {
166 struct fuse_req *req;
167 sigset_t oldset;
168 int intr;
169 int err;
170 atomic_inc(&fc->num_waiting);
171
172 if (fuse_block_alloc(fc, for_background)) {
173 err = -EINTR;
174 block_sigs(&oldset);
> 175 intr = wait_fatal_freezable(fc->blocked_waitq,
176 !fuse_block_alloc(fc, for_background), true);
177 restore_sigs(&oldset);
178 if (intr)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip