aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-07 12:23:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-07 12:23:12 -0400
commit091a0f278510696f3f573618cc7381c6f35659cb (patch)
tree553dd9152797a46afc14d2bc1ca633b6c653f9e9
parent70f2ae1f002b0ed4b4382210df8e4b6e54079012 (diff)
parentb1116bc03c00255b7e5feaed561e8bb2fc38c0f8 (diff)
Merge tag 'for-linus-4.18-ofs' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux
Pull orangefs updates from Mike Marshall: "Fixes and cleanups: - fix some sparse warnings - cleanup some code formatting - fix up some attribute/meta-data related code" * tag 'for-linus-4.18-ofs' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux: orangefs: use sparse annotations for holding locks across function calls. orangefs: make debug_help_fops static orangefs: remove unused function orangefs_get_bufmap_init orangefs: specify user pointers when using dev_map_desc and bufmap orangefs: formatting cleanups orangefs: set i_size on new symlink orangefs: report attributes_mask and attributes for statx orangefs: make struct orangefs_file_vm_ops static orangefs: revamp block sizes
-rw-r--r--fs/orangefs/devorangefs-req.c17
-rw-r--r--fs/orangefs/file.c4
-rw-r--r--fs/orangefs/inode.c57
-rw-r--r--fs/orangefs/namei.c7
-rw-r--r--fs/orangefs/orangefs-bufmap.c20
-rw-r--r--fs/orangefs/orangefs-debugfs.c2
-rw-r--r--fs/orangefs/orangefs-kernel.h1
-rw-r--r--fs/orangefs/orangefs-utils.c30
-rw-r--r--fs/orangefs/protocol.h2
-rw-r--r--fs/orangefs/super.c13
-rw-r--r--fs/orangefs/waitqueue.c14
11 files changed, 91 insertions, 76 deletions
diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c
index 66369ec90020..74b37cbbd5d4 100644
--- a/fs/orangefs/devorangefs-req.c
+++ b/fs/orangefs/devorangefs-req.c
@@ -281,14 +281,17 @@ restart:
281 ret = copy_to_user(buf, &proto_ver, sizeof(__s32)); 281 ret = copy_to_user(buf, &proto_ver, sizeof(__s32));
282 if (ret != 0) 282 if (ret != 0)
283 goto error; 283 goto error;
284 ret = copy_to_user(buf+sizeof(__s32), &magic, sizeof(__s32)); 284 ret = copy_to_user(buf + sizeof(__s32), &magic, sizeof(__s32));
285 if (ret != 0) 285 if (ret != 0)
286 goto error; 286 goto error;
287 ret = copy_to_user(buf+2 * sizeof(__s32), &cur_op->tag, sizeof(__u64)); 287 ret = copy_to_user(buf + 2 * sizeof(__s32),
288 &cur_op->tag,
289 sizeof(__u64));
288 if (ret != 0) 290 if (ret != 0)
289 goto error; 291 goto error;
290 ret = copy_to_user(buf+2*sizeof(__s32)+sizeof(__u64), &cur_op->upcall, 292 ret = copy_to_user(buf + 2 * sizeof(__s32) + sizeof(__u64),
291 sizeof(struct orangefs_upcall_s)); 293 &cur_op->upcall,
294 sizeof(struct orangefs_upcall_s));
292 if (ret != 0) 295 if (ret != 0)
293 goto error; 296 goto error;
294 297
@@ -381,7 +384,7 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
381 (unsigned int) MAX_DEV_REQ_DOWNSIZE); 384 (unsigned int) MAX_DEV_REQ_DOWNSIZE);
382 return -EFAULT; 385 return -EFAULT;
383 } 386 }
384 387
385 if (!copy_from_iter_full(&head, head_size, iter)) { 388 if (!copy_from_iter_full(&head, head_size, iter)) {
386 gossip_err("%s: failed to copy head.\n", __func__); 389 gossip_err("%s: failed to copy head.\n", __func__);
387 return -EFAULT; 390 return -EFAULT;
@@ -426,7 +429,7 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
426 goto wakeup; 429 goto wakeup;
427 430
428 /* 431 /*
429 * We've successfully peeled off the head and the downcall. 432 * We've successfully peeled off the head and the downcall.
430 * Something has gone awry if total doesn't equal the 433 * Something has gone awry if total doesn't equal the
431 * sum of head_size, downcall_size and trailer_size. 434 * sum of head_size, downcall_size and trailer_size.
432 */ 435 */
@@ -477,7 +480,7 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
477wakeup: 480wakeup:
478 /* 481 /*
479 * Return to vfs waitqueue, and back to service_operation 482 * Return to vfs waitqueue, and back to service_operation
480 * through wait_for_matching_downcall. 483 * through wait_for_matching_downcall.
481 */ 484 */
482 spin_lock(&op->lock); 485 spin_lock(&op->lock);
483 if (unlikely(op_is_cancel(op))) { 486 if (unlikely(op_is_cancel(op))) {
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index 26358efbf794..db0b52187cbc 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -162,7 +162,7 @@ populate_shared_memory:
162 else 162 else
163 ret = 0; 163 ret = 0;
164 break; 164 break;
165 /* 165 /*
166 * If the op was in progress when the interrupt 166 * If the op was in progress when the interrupt
167 * occurred, then the client-core was able to 167 * occurred, then the client-core was able to
168 * trigger the write. 168 * trigger the write.
@@ -544,7 +544,7 @@ static int orangefs_fault(struct vm_fault *vmf)
544 return filemap_fault(vmf); 544 return filemap_fault(vmf);
545} 545}
546 546
547const struct vm_operations_struct orangefs_file_vm_ops = { 547static const struct vm_operations_struct orangefs_file_vm_ops = {
548 .fault = orangefs_fault, 548 .fault = orangefs_fault,
549 .map_pages = filemap_map_pages, 549 .map_pages = filemap_map_pages,
550 .page_mkwrite = filemap_page_mkwrite, 550 .page_mkwrite = filemap_page_mkwrite,
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 79c61da8b1bc..d6db252e6200 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -20,8 +20,8 @@ static int read_one_page(struct page *page)
20 int max_block; 20 int max_block;
21 ssize_t bytes_read = 0; 21 ssize_t bytes_read = 0;
22 struct inode *inode = page->mapping->host; 22 struct inode *inode = page->mapping->host;
23 const __u32 blocksize = PAGE_SIZE; /* inode->i_blksize */ 23 const __u32 blocksize = PAGE_SIZE;
24 const __u32 blockbits = PAGE_SHIFT; /* inode->i_blkbits */ 24 const __u32 blockbits = PAGE_SHIFT;
25 struct iov_iter to; 25 struct iov_iter to;
26 struct bio_vec bv = {.bv_page = page, .bv_len = PAGE_SIZE}; 26 struct bio_vec bv = {.bv_page = page, .bv_len = PAGE_SIZE};
27 27
@@ -181,16 +181,15 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr)
181 new_op->upcall.req.truncate.refn = orangefs_inode->refn; 181 new_op->upcall.req.truncate.refn = orangefs_inode->refn;
182 new_op->upcall.req.truncate.size = (__s64) iattr->ia_size; 182 new_op->upcall.req.truncate.size = (__s64) iattr->ia_size;
183 183
184 ret = service_operation(new_op, __func__, 184 ret = service_operation(new_op,
185 get_interruptible_flag(inode)); 185 __func__,
186 get_interruptible_flag(inode));
186 187
187 /* 188 /*
188 * the truncate has no downcall members to retrieve, but 189 * the truncate has no downcall members to retrieve, but
189 * the status value tells us if it went through ok or not 190 * the status value tells us if it went through ok or not
190 */ 191 */
191 gossip_debug(GOSSIP_INODE_DEBUG, 192 gossip_debug(GOSSIP_INODE_DEBUG, "%s: ret:%d:\n", __func__, ret);
192 "orangefs: orangefs_truncate got return value of %d\n",
193 ret);
194 193
195 op_release(new_op); 194 op_release(new_op);
196 195
@@ -212,8 +211,9 @@ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr)
212 struct inode *inode = dentry->d_inode; 211 struct inode *inode = dentry->d_inode;
213 212
214 gossip_debug(GOSSIP_INODE_DEBUG, 213 gossip_debug(GOSSIP_INODE_DEBUG,
215 "orangefs_setattr: called on %pd\n", 214 "%s: called on %pd\n",
216 dentry); 215 __func__,
216 dentry);
217 217
218 ret = setattr_prepare(dentry, iattr); 218 ret = setattr_prepare(dentry, iattr);
219 if (ret) 219 if (ret)
@@ -230,15 +230,16 @@ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr)
230 230
231 ret = orangefs_inode_setattr(inode, iattr); 231 ret = orangefs_inode_setattr(inode, iattr);
232 gossip_debug(GOSSIP_INODE_DEBUG, 232 gossip_debug(GOSSIP_INODE_DEBUG,
233 "orangefs_setattr: inode_setattr returned %d\n", 233 "%s: orangefs_inode_setattr returned %d\n",
234 ret); 234 __func__,
235 ret);
235 236
236 if (!ret && (iattr->ia_valid & ATTR_MODE)) 237 if (!ret && (iattr->ia_valid & ATTR_MODE))
237 /* change mod on a file that has ACLs */ 238 /* change mod on a file that has ACLs */
238 ret = posix_acl_chmod(inode, inode->i_mode); 239 ret = posix_acl_chmod(inode, inode->i_mode);
239 240
240out: 241out:
241 gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_setattr: returning %d\n", ret); 242 gossip_debug(GOSSIP_INODE_DEBUG, "%s: ret:%d:\n", __func__, ret);
242 return ret; 243 return ret;
243} 244}
244 245
@@ -262,13 +263,19 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,
262 263
263 /* override block size reported to stat */ 264 /* override block size reported to stat */
264 orangefs_inode = ORANGEFS_I(inode); 265 orangefs_inode = ORANGEFS_I(inode);
265 stat->blksize = orangefs_inode->blksize;
266 266
267 if (request_mask & STATX_SIZE) 267 if (request_mask & STATX_SIZE)
268 stat->result_mask = STATX_BASIC_STATS; 268 stat->result_mask = STATX_BASIC_STATS;
269 else 269 else
270 stat->result_mask = STATX_BASIC_STATS & 270 stat->result_mask = STATX_BASIC_STATS &
271 ~STATX_SIZE; 271 ~STATX_SIZE;
272
273 stat->attributes_mask = STATX_ATTR_IMMUTABLE |
274 STATX_ATTR_APPEND;
275 if (inode->i_flags & S_IMMUTABLE)
276 stat->attributes |= STATX_ATTR_IMMUTABLE;
277 if (inode->i_flags & S_APPEND)
278 stat->attributes |= STATX_ATTR_APPEND;
272 } 279 }
273 return ret; 280 return ret;
274} 281}
@@ -306,7 +313,7 @@ int orangefs_update_time(struct inode *inode, struct timespec *time, int flags)
306 return orangefs_inode_setattr(inode, &iattr); 313 return orangefs_inode_setattr(inode, &iattr);
307} 314}
308 315
309/* ORANGEDS2 implementation of VFS inode operations for files */ 316/* ORANGEFS2 implementation of VFS inode operations for files */
310static const struct inode_operations orangefs_file_inode_operations = { 317static const struct inode_operations orangefs_file_inode_operations = {
311 .get_acl = orangefs_get_acl, 318 .get_acl = orangefs_get_acl,
312 .set_acl = orangefs_set_acl, 319 .set_acl = orangefs_set_acl,
@@ -325,7 +332,6 @@ static int orangefs_init_iops(struct inode *inode)
325 case S_IFREG: 332 case S_IFREG:
326 inode->i_op = &orangefs_file_inode_operations; 333 inode->i_op = &orangefs_file_inode_operations;
327 inode->i_fop = &orangefs_file_operations; 334 inode->i_fop = &orangefs_file_operations;
328 inode->i_blkbits = PAGE_SHIFT;
329 break; 335 break;
330 case S_IFLNK: 336 case S_IFLNK:
331 inode->i_op = &orangefs_symlink_inode_operations; 337 inode->i_op = &orangefs_symlink_inode_operations;
@@ -345,8 +351,8 @@ static int orangefs_init_iops(struct inode *inode)
345} 351}
346 352
347/* 353/*
348 * Given a ORANGEFS object identifier (fsid, handle), convert it into a ino_t type 354 * Given an ORANGEFS object identifier (fsid, handle), convert it into
349 * that will be used as a hash-index from where the handle will 355 * a ino_t type that will be used as a hash-index from where the handle will
350 * be searched for in the VFS hash table of inodes. 356 * be searched for in the VFS hash table of inodes.
351 */ 357 */
352static inline ino_t orangefs_handle_hash(struct orangefs_object_kref *ref) 358static inline ino_t orangefs_handle_hash(struct orangefs_object_kref *ref)
@@ -376,8 +382,10 @@ static int orangefs_test_inode(struct inode *inode, void *data)
376 struct orangefs_inode_s *orangefs_inode = NULL; 382 struct orangefs_inode_s *orangefs_inode = NULL;
377 383
378 orangefs_inode = ORANGEFS_I(inode); 384 orangefs_inode = ORANGEFS_I(inode);
379 return (!ORANGEFS_khandle_cmp(&(orangefs_inode->refn.khandle), &(ref->khandle)) 385 /* test handles and fs_ids... */
380 && orangefs_inode->refn.fs_id == ref->fs_id); 386 return (!ORANGEFS_khandle_cmp(&(orangefs_inode->refn.khandle),
387 &(ref->khandle)) &&
388 orangefs_inode->refn.fs_id == ref->fs_id);
381} 389}
382 390
383/* 391/*
@@ -385,16 +393,21 @@ static int orangefs_test_inode(struct inode *inode, void *data)
385 * file handle. 393 * file handle.
386 * 394 *
387 * @sb: the file system super block instance. 395 * @sb: the file system super block instance.
388 * @ref: The ORANGEFS object for which we are trying to locate an inode structure. 396 * @ref: The ORANGEFS object for which we are trying to locate an inode.
389 */ 397 */
390struct inode *orangefs_iget(struct super_block *sb, struct orangefs_object_kref *ref) 398struct inode *orangefs_iget(struct super_block *sb,
399 struct orangefs_object_kref *ref)
391{ 400{
392 struct inode *inode = NULL; 401 struct inode *inode = NULL;
393 unsigned long hash; 402 unsigned long hash;
394 int error; 403 int error;
395 404
396 hash = orangefs_handle_hash(ref); 405 hash = orangefs_handle_hash(ref);
397 inode = iget5_locked(sb, hash, orangefs_test_inode, orangefs_set_inode, ref); 406 inode = iget5_locked(sb,
407 hash,
408 orangefs_test_inode,
409 orangefs_set_inode,
410 ref);
398 if (!inode || !(inode->i_state & I_NEW)) 411 if (!inode || !(inode->i_state & I_NEW))
399 return inode; 412 return inode;
400 413
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c
index 365cd73d9109..625b0580f9be 100644
--- a/fs/orangefs/namei.c
+++ b/fs/orangefs/namei.c
@@ -278,6 +278,13 @@ static int orangefs_symlink(struct inode *dir,
278 ret = PTR_ERR(inode); 278 ret = PTR_ERR(inode);
279 goto out; 279 goto out;
280 } 280 }
281 /*
282 * This is necessary because orangefs_inode_getattr will not
283 * re-read symlink size as it is impossible for it to change.
284 * Invalidating the cache does not help. orangefs_new_inode
285 * does not set the correct size (it does not know symname).
286 */
287 inode->i_size = strlen(symname);
281 288
282 gossip_debug(GOSSIP_NAME_DEBUG, 289 gossip_debug(GOSSIP_NAME_DEBUG,
283 "Assigned symlink inode new number of %pU\n", 290 "Assigned symlink inode new number of %pU\n",
diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c
index 4f927023d095..c4e98c9c1621 100644
--- a/fs/orangefs/orangefs-bufmap.c
+++ b/fs/orangefs/orangefs-bufmap.c
@@ -138,7 +138,7 @@ static int get(struct slot_map *m)
138 138
139/* used to describe mapped buffers */ 139/* used to describe mapped buffers */
140struct orangefs_bufmap_desc { 140struct orangefs_bufmap_desc {
141 void *uaddr; /* user space address pointer */ 141 void __user *uaddr; /* user space address pointer */
142 struct page **page_array; /* array of mapped pages */ 142 struct page **page_array; /* array of mapped pages */
143 int array_count; /* size of above arrays */ 143 int array_count; /* size of above arrays */
144 struct list_head list_link; 144 struct list_head list_link;
@@ -184,7 +184,7 @@ orangefs_bufmap_free(struct orangefs_bufmap *bufmap)
184} 184}
185 185
186/* 186/*
187 * XXX: Can the size and shift change while the caller gives up the 187 * XXX: Can the size and shift change while the caller gives up the
188 * XXX: lock between calling this and doing something useful? 188 * XXX: lock between calling this and doing something useful?
189 */ 189 */
190 190
@@ -215,20 +215,6 @@ int orangefs_bufmap_shift_query(void)
215static DECLARE_WAIT_QUEUE_HEAD(bufmap_waitq); 215static DECLARE_WAIT_QUEUE_HEAD(bufmap_waitq);
216static DECLARE_WAIT_QUEUE_HEAD(readdir_waitq); 216static DECLARE_WAIT_QUEUE_HEAD(readdir_waitq);
217 217
218/*
219 * orangefs_get_bufmap_init
220 *
221 * If bufmap_init is 1, then the shared memory system, including the
222 * buffer_index_array, is available. Otherwise, it is not.
223 *
224 * returns the value of bufmap_init
225 */
226int orangefs_get_bufmap_init(void)
227{
228 return __orangefs_bufmap ? 1 : 0;
229}
230
231
232static struct orangefs_bufmap * 218static struct orangefs_bufmap *
233orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc) 219orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc)
234{ 220{
@@ -496,7 +482,7 @@ void orangefs_readdir_index_put(int buffer_index)
496} 482}
497 483
498/* 484/*
499 * we've been handed an iovec, we need to copy it to 485 * we've been handed an iovec, we need to copy it to
500 * the shared memory descriptor at "buffer_index". 486 * the shared memory descriptor at "buffer_index".
501 */ 487 */
502int orangefs_bufmap_copy_from_iovec(struct iov_iter *iter, 488int orangefs_bufmap_copy_from_iovec(struct iov_iter *iter,
diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c
index 6e35f2f3c897..0732cb08173e 100644
--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -114,7 +114,7 @@ static const struct seq_operations help_debug_ops = {
114 .show = help_show, 114 .show = help_show,
115}; 115};
116 116
117const struct file_operations debug_help_fops = { 117static const struct file_operations debug_help_fops = {
118 .owner = THIS_MODULE, 118 .owner = THIS_MODULE,
119 .open = orangefs_debug_help_open, 119 .open = orangefs_debug_help_open,
120 .read = seq_read, 120 .read = seq_read,
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index c29bb0ebc6bb..004511617b6d 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -182,7 +182,6 @@ static inline void set_op_state_purged(struct orangefs_kernel_op_s *op)
182struct orangefs_inode_s { 182struct orangefs_inode_s {
183 struct orangefs_object_kref refn; 183 struct orangefs_object_kref refn;
184 char link_target[ORANGEFS_NAME_MAX]; 184 char link_target[ORANGEFS_NAME_MAX];
185 __s64 blksize;
186 /* 185 /*
187 * Reading/Writing Extended attributes need to acquire the appropriate 186 * Reading/Writing Extended attributes need to acquire the appropriate
188 * reader/writer semaphore on the orangefs_inode_s structure. 187 * reader/writer semaphore on the orangefs_inode_s structure.
diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
index 00fadaf0da8f..804c8a261e4b 100644
--- a/fs/orangefs/orangefs-utils.c
+++ b/fs/orangefs/orangefs-utils.c
@@ -183,9 +183,9 @@ static inline int copy_attributes_from_inode(struct inode *inode,
183 attrs->mask |= ORANGEFS_ATTR_SYS_CTIME; 183 attrs->mask |= ORANGEFS_ATTR_SYS_CTIME;
184 184
185 /* 185 /*
186 * ORANGEFS cannot set size with a setattr operation. Probably not likely 186 * ORANGEFS cannot set size with a setattr operation. Probably not
187 * to be requested through the VFS, but just in case, don't worry about 187 * likely to be requested through the VFS, but just in case, don't
188 * ATTR_SIZE 188 * worry about ATTR_SIZE
189 */ 189 */
190 190
191 if (iattr->ia_valid & ATTR_MODE) { 191 if (iattr->ia_valid & ATTR_MODE) {
@@ -200,14 +200,16 @@ static inline int copy_attributes_from_inode(struct inode *inode,
200 tmp_mode -= S_ISVTX; 200 tmp_mode -= S_ISVTX;
201 } else { 201 } else {
202 gossip_debug(GOSSIP_UTILS_DEBUG, 202 gossip_debug(GOSSIP_UTILS_DEBUG,
203 "User attempted to set sticky bit on non-root directory; returning EINVAL.\n"); 203 "%s: setting sticky bit not supported.\n",
204 __func__);
204 return -EINVAL; 205 return -EINVAL;
205 } 206 }
206 } 207 }
207 208
208 if (tmp_mode & (S_ISUID)) { 209 if (tmp_mode & (S_ISUID)) {
209 gossip_debug(GOSSIP_UTILS_DEBUG, 210 gossip_debug(GOSSIP_UTILS_DEBUG,
210 "Attempting to set setuid bit (not supported); returning EINVAL.\n"); 211 "%s: setting setuid bit not supported.\n",
212 __func__);
211 return -EINVAL; 213 return -EINVAL;
212 } 214 }
213 215
@@ -275,7 +277,7 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
275{ 277{
276 struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); 278 struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
277 struct orangefs_kernel_op_s *new_op; 279 struct orangefs_kernel_op_s *new_op;
278 loff_t inode_size, rounded_up_size; 280 loff_t inode_size;
279 int ret, type; 281 int ret, type;
280 282
281 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: called on inode %pU\n", __func__, 283 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: called on inode %pU\n", __func__,
@@ -330,22 +332,19 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
330 if (request_mask & STATX_SIZE || new) { 332 if (request_mask & STATX_SIZE || new) {
331 inode_size = (loff_t)new_op-> 333 inode_size = (loff_t)new_op->
332 downcall.resp.getattr.attributes.size; 334 downcall.resp.getattr.attributes.size;
333 rounded_up_size =
334 (inode_size + (4096 - (inode_size % 4096)));
335 inode->i_size = inode_size; 335 inode->i_size = inode_size;
336 orangefs_inode->blksize = 336 inode->i_blkbits = ffs(new_op->downcall.resp.getattr.
337 new_op->downcall.resp.getattr.attributes.blksize; 337 attributes.blksize);
338 spin_lock(&inode->i_lock); 338 spin_lock(&inode->i_lock);
339 inode->i_bytes = inode_size; 339 inode->i_bytes = inode_size;
340 inode->i_blocks = 340 inode->i_blocks =
341 (unsigned long)(rounded_up_size / 512); 341 (inode_size + 512 - inode_size % 512)/512;
342 spin_unlock(&inode->i_lock); 342 spin_unlock(&inode->i_lock);
343 } 343 }
344 break; 344 break;
345 case S_IFDIR: 345 case S_IFDIR:
346 if (request_mask & STATX_SIZE || new) { 346 if (request_mask & STATX_SIZE || new) {
347 inode->i_size = PAGE_SIZE; 347 inode->i_size = PAGE_SIZE;
348 orangefs_inode->blksize = i_blocksize(inode);
349 spin_lock(&inode->i_lock); 348 spin_lock(&inode->i_lock);
350 inode_set_bytes(inode, inode->i_size); 349 inode_set_bytes(inode, inode->i_size);
351 spin_unlock(&inode->i_lock); 350 spin_unlock(&inode->i_lock);
@@ -356,7 +355,6 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass,
356 if (new) { 355 if (new) {
357 inode->i_size = (loff_t)strlen(new_op-> 356 inode->i_size = (loff_t)strlen(new_op->
358 downcall.resp.getattr.link_target); 357 downcall.resp.getattr.link_target);
359 orangefs_inode->blksize = i_blocksize(inode);
360 ret = strscpy(orangefs_inode->link_target, 358 ret = strscpy(orangefs_inode->link_target,
361 new_op->downcall.resp.getattr.link_target, 359 new_op->downcall.resp.getattr.link_target,
362 ORANGEFS_NAME_MAX); 360 ORANGEFS_NAME_MAX);
@@ -525,7 +523,9 @@ int orangefs_normalize_to_errno(__s32 error_code)
525 error_code = -ETIMEDOUT; 523 error_code = -ETIMEDOUT;
526 } else { 524 } else {
527 /* assume a default error code */ 525 /* assume a default error code */
528 gossip_err("orangefs: warning: got error code without errno equivalent: %d.\n", error_code); 526 gossip_err("%s: bad error code :%d:.\n",
527 __func__,
528 error_code);
529 error_code = -EINVAL; 529 error_code = -EINVAL;
530 } 530 }
531 531
@@ -542,7 +542,7 @@ int orangefs_normalize_to_errno(__s32 error_code)
542 * there is a bug somewhere. 542 * there is a bug somewhere.
543 */ 543 */
544 } else { 544 } else {
545 gossip_err("orangefs: orangefs_normalize_to_errno: got error code which is not from ORANGEFS.\n"); 545 gossip_err("%s: unknown error code.\n", __func__);
546 error_code = -EINVAL; 546 error_code = -EINVAL;
547 } 547 }
548 return error_code; 548 return error_code;
diff --git a/fs/orangefs/protocol.h b/fs/orangefs/protocol.h
index 61ee8d64c842..d403cf29a99b 100644
--- a/fs/orangefs/protocol.h
+++ b/fs/orangefs/protocol.h
@@ -342,7 +342,7 @@ enum {
342 * that may be 32 bit! 342 * that may be 32 bit!
343 */ 343 */
344struct ORANGEFS_dev_map_desc { 344struct ORANGEFS_dev_map_desc {
345 void *ptr; 345 void __user *ptr;
346 __s32 total_size; 346 __s32 total_size;
347 __s32 size; 347 __s32 size;
348 __s32 count; 348 __s32 count;
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c
index 10796d3fe27d..dfaee90d30bd 100644
--- a/fs/orangefs/super.c
+++ b/fs/orangefs/super.c
@@ -156,9 +156,10 @@ static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf)
156 sb = dentry->d_sb; 156 sb = dentry->d_sb;
157 157
158 gossip_debug(GOSSIP_SUPER_DEBUG, 158 gossip_debug(GOSSIP_SUPER_DEBUG,
159 "orangefs_statfs: called on sb %p (fs_id is %d)\n", 159 "%s: called on sb %p (fs_id is %d)\n",
160 sb, 160 __func__,
161 (int)(ORANGEFS_SB(sb)->fs_id)); 161 sb,
162 (int)(ORANGEFS_SB(sb)->fs_id));
162 163
163 new_op = op_alloc(ORANGEFS_VFS_OP_STATFS); 164 new_op = op_alloc(ORANGEFS_VFS_OP_STATFS);
164 if (!new_op) 165 if (!new_op)
@@ -198,7 +199,7 @@ static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf)
198 199
199out_op_release: 200out_op_release:
200 op_release(new_op); 201 op_release(new_op);
201 gossip_debug(GOSSIP_SUPER_DEBUG, "orangefs_statfs: returning %d\n", ret); 202 gossip_debug(GOSSIP_SUPER_DEBUG, "%s: returning %d\n", __func__, ret);
202 return ret; 203 return ret;
203} 204}
204 205
@@ -423,8 +424,8 @@ static int orangefs_fill_sb(struct super_block *sb,
423 sb->s_op = &orangefs_s_ops; 424 sb->s_op = &orangefs_s_ops;
424 sb->s_d_op = &orangefs_dentry_operations; 425 sb->s_d_op = &orangefs_dentry_operations;
425 426
426 sb->s_blocksize = orangefs_bufmap_size_query(); 427 sb->s_blocksize = PAGE_SIZE;
427 sb->s_blocksize_bits = orangefs_bufmap_shift_query(); 428 sb->s_blocksize_bits = PAGE_SHIFT;
428 sb->s_maxbytes = MAX_LFS_FILESIZE; 429 sb->s_maxbytes = MAX_LFS_FILESIZE;
429 430
430 root_object.khandle = ORANGEFS_SB(sb)->root_khandle; 431 root_object.khandle = ORANGEFS_SB(sb)->root_khandle;
diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c
index 0577d6dba8c8..0729d2645d6a 100644
--- a/fs/orangefs/waitqueue.c
+++ b/fs/orangefs/waitqueue.c
@@ -17,8 +17,12 @@
17#include "orangefs-kernel.h" 17#include "orangefs-kernel.h"
18#include "orangefs-bufmap.h" 18#include "orangefs-bufmap.h"
19 19
20static int wait_for_matching_downcall(struct orangefs_kernel_op_s *, long, bool); 20static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
21static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *); 21 long timeout,
22 bool interruptible)
23 __acquires(op->lock);
24static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op)
25 __releases(op->lock);
22 26
23/* 27/*
24 * What we do in this function is to walk the list of operations that are 28 * What we do in this function is to walk the list of operations that are
@@ -246,6 +250,7 @@ bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op)
246 */ 250 */
247static void 251static void
248 orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op) 252 orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op)
253 __releases(op->lock)
249{ 254{
250 /* 255 /*
251 * handle interrupted cases depending on what state we were in when 256 * handle interrupted cases depending on what state we were in when
@@ -313,8 +318,9 @@ static void
313 * Returns with op->lock taken. 318 * Returns with op->lock taken.
314 */ 319 */
315static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op, 320static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
316 long timeout, 321 long timeout,
317 bool interruptible) 322 bool interruptible)
323 __acquires(op->lock)
318{ 324{
319 long n; 325 long n;
320 326