7912
|
1 |
--- Makefile.com.old 2011-11-09 13:15:20.820359500 -0500
|
|
2 |
+++ Makefile.com 2011-11-09 14:42:19.274443000 -0500
|
|
3 |
@@ -65,6 +65,7 @@
|
|
4 |
fuse_kernel.h \
|
|
5 |
fuse_lowlevel.h \
|
|
6 |
fuse_lowlevel_compat.h \
|
|
7 |
+ ulockmgr.h \
|
|
8 |
fuse_opt.h
|
|
9 |
|
|
10 |
INCHDRS = $(HDRS:%=../include/%)
|
|
11 |
@@ -105,6 +106,6 @@
|
|
12 |
$(INSTALL) -f $(ROOT)/usr/include/fuse ../include/fuse_lowlevel.h
|
|
13 |
$(INSTALL) -f $(ROOT)/usr/include/fuse ../include/fuse_lowlevel_compat.h
|
|
14 |
$(INSTALL) -f $(ROOT)/usr/include/fuse ../include/fuse_opt.h
|
|
15 |
-
|
|
16 |
+ $(INSTALL) -f $(ROOT)/usr/include/fuse ../include/ulockmgr.h
|
|
17 |
clean:
|
|
18 |
rm -f $(OBJS) $(FUSERMOUNT_OBJS) $(FUSERMOUNT) $(FUSE_LIB) $(MOUNT_FUSE) $(MOUNT_FUSE_OBJS)
|
|
19 |
+++ fuse.c 2011-11-09 13:29:16.146778000 -0500
|
|
20 |
@@ -1306,8 +1306,11 @@
|
|
21 |
{
|
|
22 |
if (!err) {
|
|
23 |
struct fuse *f = req_fuse(req);
|
|
24 |
- if (fuse_reply_entry(req, e) == -ENOENT)
|
|
25 |
+ if (fuse_reply_entry(req, e) == -ENOENT) {
|
|
26 |
+ /* Skip forget for negative result */
|
|
27 |
+ if (e->ino != 0)
|
|
28 |
forget_node(f, e->ino, 1);
|
|
29 |
+ }
|
|
30 |
} else
|
|
31 |
reply_err(req, err);
|
|
32 |
}
|
|
33 |
@@ -2071,6 +2074,7 @@
|
|
34 |
}
|
|
35 |
} else {
|
|
36 |
reply_err(req, err);
|
|
37 |
+ pthread_mutex_destroy(&dh->lock);
|
|
38 |
free(dh);
|
|
39 |
}
|
|
40 |
free(path);
|
|
41 |
@@ -2884,7 +2888,7 @@
|
|
42 |
" -o readdir_ino try to fill in d_ino in readdir\n"
|
|
43 |
" -o direct_io use direct I/O\n"
|
|
44 |
" -o kernel_cache cache files in kernel\n"
|
|
45 |
-" -o [no]auto_cache enable caching based on modification times\n"
|
|
46 |
+" -o [no]auto_cache enable caching based on modification times (off)\n"
|
|
47 |
" -o umask=M set file permissions (octal)\n"
|
|
48 |
" -o uid=N set file owner\n"
|
|
49 |
" -o gid=N set file group\n"
|
|
50 |
--- mount.c.old 2011-11-09 13:43:46.225855000 -0500
|
|
51 |
+++ mount.c 2011-11-09 13:48:00.549421000 -0500
|
|
52 |
@@ -333,10 +333,14 @@
|
|
53 |
then the filesystem is already unmounted */
|
|
54 |
if (res == 1 && (pfd.revents & POLLERR))
|
|
55 |
return;
|
|
56 |
+
|
|
57 |
+ /* Need to close file descriptor, otherwise synchronous umount
|
|
58 |
+ would recurse into filesystem, and deadlock */
|
|
59 |
+ close(fd);
|
|
60 |
}
|
|
61 |
|
|
62 |
if (geteuid() == 0) {
|
|
63 |
- fuse_mnt_umount("fuse", mountpoint, 1);
|
|
64 |
+ fuse_mnt_umount("fuse", mountpoint, 1);
|
|
65 |
return;
|
|
66 |
}
|
|
67 |
|
|
68 |
--- mount_bsd.c.old 2011-11-09 13:49:45.181396000 -0500
|
|
69 |
+++ mount_bsd.c 2011-11-09 13:56:51.955838500 -0500
|
|
70 |
@@ -215,7 +215,7 @@
|
|
71 |
dev = getenv("FUSE_DEV_NAME");
|
|
72 |
|
|
73 |
if (! dev)
|
|
74 |
- dev = FUSE_DEV_TRUNK;
|
|
75 |
+ dev = (char *)FUSE_DEV_TRUNK;
|
|
76 |
|
|
77 |
if ((fd = open(dev, O_RDWR)) < 0) {
|
|
78 |
perror("fuse: failed to open fuse device");
|
|
79 |
@@ -227,6 +227,7 @@
|
|
80 |
goto out;
|
|
81 |
|
|
82 |
pid = fork();
|
|
83 |
+ cpid = pid;
|
|
84 |
|
|
85 |
if (pid == -1) {
|
|
86 |
perror("fuse: fork() failed");
|
|
87 |
@@ -235,6 +236,13 @@
|
|
88 |
}
|
|
89 |
|
|
90 |
if (pid == 0) {
|
|
91 |
+ if (! init_backgrounded()) {
|
|
92 |
+ /*
|
|
93 |
+ * If init is not backgrounded, we have to
|
|
94 |
+ * call the mount util backgrounded, to avoid
|
|
95 |
+ * deadlock.
|
|
96 |
+ */
|
|
97 |
+
|
|
98 |
pid = fork();
|
|
99 |
|
|
100 |
if (pid == -1) {
|
|
101 |
@@ -242,14 +250,17 @@
|
|
102 |
close(fd);
|
|
103 |
exit(1);
|
|
104 |
}
|
|
105 |
+ }
|
|
106 |
|
|
107 |
if (pid == 0) {
|
|
108 |
const char *argv[32];
|
|
109 |
int a = 0;
|
|
110 |
|
|
111 |
- if (! fdnam)
|
|
112 |
- asprintf(&fdnam, "%d", fd);
|
|
113 |
-
|
|
114 |
+ if (! fdnam && asprintf(&fdnam, "%d", fd) == -1) {
|
|
115 |
+ perror("fuse: failed to assemble mount arguments
|
|
116 |
+");
|
|
117 |
+ exit(1);
|
|
118 |
+ }
|
|
119 |
argv[a++] = mountprog;
|
|
120 |
if (opts) {
|
|
121 |
argv[a++] = "-o";
|
|
122 |
@@ -266,7 +277,11 @@
|
|
123 |
exit(0);
|
|
124 |
}
|
|
125 |
|
|
126 |
- waitpid(pid, NULL, 0);
|
|
127 |
+ if (waitpid(cpid, &status, 0) == -1 || WEXITSTATUS(status) != 0) {
|
|
128 |
+ perror("fuse: failed to mount file system");
|
|
129 |
+ close(fd);
|
|
130 |
+ return -1;
|
|
131 |
+ }
|
|
132 |
|
|
133 |
out:
|
|
134 |
return fd;
|
|
135 |
--- ../../libfuse/fuse.pc 2010-06-15 15:46:54.000000000 +0100
|
|
136 |
+++ fuse.pc 2011-11-09 17:54:57.131890866 +0000
|
|
137 |
@@ -5,6 +5,6 @@
|
|
138 |
|
|
139 |
Name: fuse
|
|
140 |
Description: Filesystem in Userspace
|
|
141 |
-Version: 2.7.1
|
|
142 |
+Version: 2.7.6
|
|
143 |
Libs: -L${libdir} -lfuse -lxnet
|
|
144 |
Cflags: -I${includedir}/fuse -D_FILE_OFFSET_BITS=64
|
|
145 |
--- /dev/null 2011-11-09 16:44:05.000000000 +0000
|
|
146 |
+++ include/ulockmgr.h 2011-02-02 11:00:22.000000000 +0000
|
|
147 |
@@ -0,0 +1,24 @@
|
|
148 |
+/*
|
|
149 |
+ libulockmgr: Userspace Lock Manager Library
|
|
150 |
+ Copyright (C) 2006 Miklos Szeredi <[email protected]>
|
|
151 |
+
|
|
152 |
+ This program can be distributed under the terms of the GNU LGPLv2.
|
|
153 |
+ See the file COPYING.LIB.
|
|
154 |
+*/
|
|
155 |
+
|
|
156 |
+#include <stdint.h>
|
|
157 |
+#include <fcntl.h>
|
|
158 |
+#include <sys/types.h>
|
|
159 |
+
|
|
160 |
+/**
|
|
161 |
+ * Perform POSIX locking operation
|
|
162 |
+ *
|
|
163 |
+ * @param fd the file descriptor
|
|
164 |
+ * @param cmd the locking command (F_GETFL, F_SETLK or F_SETLKW)
|
|
165 |
+ * @param lock the lock parameters
|
|
166 |
+ * @param owner the lock owner ID cookie
|
|
167 |
+ * @param owner_len length of the lock owner ID cookie
|
|
168 |
+ * @return 0 on success -errno on error
|
|
169 |
+ */
|
|
170 |
+int ulockmgr_op(int fd, int cmd, struct flock *lock, const void *owner,
|
|
171 |
+ size_t owner_len);
|
7913
|
172 |
--- ../../libfuse/fuse_loop_mt.c 2010-06-15 15:46:54.000000000 +0100
|
|
173 |
+++ fuse_loop_mt.c 2011-09-13 08:23:14.000000000 +0100
|
|
174 |
@@ -2,7 +2,7 @@
|
|
175 |
FUSE: Filesystem in Userspace
|
|
176 |
Copyright (C) 2001-2007 Miklos Szeredi <[email protected]>
|
|
177 |
|
|
178 |
- This program can be distributed under the terms of the GNU LGPL.
|
|
179 |
+ This program can be distributed under the terms of the GNU LGPLv2.
|
|
180 |
See the file COPYING.LIB.
|
|
181 |
*/
|
|
182 |
|
|
183 |
@@ -19,6 +19,9 @@
|
|
184 |
#include <errno.h>
|
|
185 |
#include <sys/time.h>
|
|
186 |
|
|
187 |
+/* Environment var controlling the thread stack size */
|
|
188 |
+#define ENVNAME_THREAD_STACK "FUSE_THREAD_STACK"
|
|
189 |
+
|
|
190 |
struct fuse_worker {
|
|
191 |
struct fuse_worker *prev;
|
|
192 |
struct fuse_worker *next;
|
|
193 |
@@ -67,7 +70,11 @@
|
|
194 |
while (!fuse_session_exited(mt->se)) {
|
|
195 |
int isforget = 0;
|
|
196 |
struct fuse_chan *ch = mt->prevch;
|
|
197 |
- int res = fuse_chan_recv(&ch, w->buf, w->bufsize);
|
|
198 |
+ int res;
|
|
199 |
+
|
|
200 |
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
|
201 |
+ res = fuse_chan_recv(&ch, w->buf, w->bufsize);
|
|
202 |
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
|
203 |
if (res == -EINTR)
|
|
204 |
continue;
|
|
205 |
if (res <= 0) {
|
|
206 |
@@ -121,6 +128,7 @@
|
|
207 |
}
|
|
208 |
|
|
209 |
sem_post(&mt->finish);
|
|
210 |
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
|
211 |
pause();
|
|
212 |
|
|
213 |
return NULL;
|
|
214 |
@@ -131,6 +139,8 @@
|
|
215 |
sigset_t oldset;
|
|
216 |
sigset_t newset;
|
|
217 |
int res;
|
|
218 |
+ pthread_attr_t attr;
|
|
219 |
+ char *stack_size;
|
|
220 |
struct fuse_worker *w = malloc(sizeof(struct fuse_worker));
|
|
221 |
if (!w) {
|
|
222 |
fprintf(stderr, "fuse: failed to allocate worker structure\n");
|
|
223 |
@@ -146,6 +156,12 @@
|
|
224 |
return -1;
|
|
225 |
}
|
|
226 |
|
|
227 |
+ /* Override default stack size */
|
|
228 |
+ pthread_attr_init(&attr);
|
|
229 |
+ stack_size = getenv(ENVNAME_THREAD_STACK);
|
|
230 |
+ if (stack_size && pthread_attr_setstacksize(&attr, atoi(stack_size)))
|
|
231 |
+ fprintf(stderr, "fuse: invalid stack size: %s\n", stack_size);
|
|
232 |
+
|
|
233 |
/* Disallow signal reception in worker threads */
|
|
234 |
sigemptyset(&newset);
|
|
235 |
sigaddset(&newset, SIGTERM);
|
|
236 |
@@ -153,10 +169,12 @@
|
|
237 |
sigaddset(&newset, SIGHUP);
|
|
238 |
sigaddset(&newset, SIGQUIT);
|
|
239 |
pthread_sigmask(SIG_BLOCK, &newset, &oldset);
|
|
240 |
- res = pthread_create(&w->thread_id, NULL, fuse_do_work, w);
|
|
241 |
+ res = pthread_create(&w->thread_id, &attr, fuse_do_work, w);
|
|
242 |
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
|
|
243 |
+ pthread_attr_destroy(&attr);
|
|
244 |
if (res != 0) {
|
|
245 |
- fprintf(stderr, "fuse: error creating thread: %s\n", strerror(res));
|
|
246 |
+ fprintf(stderr, "fuse: error creating thread: %s\n",
|
|
247 |
+ strerror(res));
|
|
248 |
free(w->buf);
|
|
249 |
free(w);
|
|
250 |
return -1;
|