ioctl.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. /*
  2. * linux/fs/ocfs2/ioctl.c
  3. *
  4. * Copyright (C) 2006 Herbert Poetzl
  5. * adapted from Remy Card's ext2/ioctl.c
  6. */
  7. #include <linux/fs.h>
  8. #include <linux/mount.h>
  9. #include <linux/compat.h>
  10. #include <cluster/masklog.h>
  11. #include "ocfs2.h"
  12. #include "alloc.h"
  13. #include "dlmglue.h"
  14. #include "file.h"
  15. #include "inode.h"
  16. #include "journal.h"
  17. #include "ocfs2_fs.h"
  18. #include "ioctl.h"
  19. #include "resize.h"
  20. #include "refcounttree.h"
  21. #include "sysfile.h"
  22. #include "dir.h"
  23. #include "buffer_head_io.h"
  24. #include <linux/ext2_fs.h>
  25. #define o2info_from_user(a, b) \
  26. copy_from_user(&(a), (b), sizeof(a))
  27. #define o2info_to_user(a, b) \
  28. copy_to_user((typeof(a) __user *)b, &(a), sizeof(a))
  29. /*
  30. * This call is void because we are already reporting an error that may
  31. * be -EFAULT. The error will be returned from the ioctl(2) call. It's
  32. * just a best-effort to tell userspace that this request caused the error.
  33. */
  34. static inline void o2info_set_request_error(struct ocfs2_info_request *kreq,
  35. struct ocfs2_info_request __user *req)
  36. {
  37. kreq->ir_flags |= OCFS2_INFO_FL_ERROR;
  38. (void)put_user(kreq->ir_flags, (__u32 __user *)&(req->ir_flags));
  39. }
  40. static inline void o2info_set_request_filled(struct ocfs2_info_request *req)
  41. {
  42. req->ir_flags |= OCFS2_INFO_FL_FILLED;
  43. }
  44. static inline void o2info_clear_request_filled(struct ocfs2_info_request *req)
  45. {
  46. req->ir_flags &= ~OCFS2_INFO_FL_FILLED;
  47. }
  48. static inline int o2info_coherent(struct ocfs2_info_request *req)
  49. {
  50. return (!(req->ir_flags & OCFS2_INFO_FL_NON_COHERENT));
  51. }
  52. static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags)
  53. {
  54. int status;
  55. status = ocfs2_inode_lock(inode, NULL, 0);
  56. if (status < 0) {
  57. mlog_errno(status);
  58. return status;
  59. }
  60. ocfs2_get_inode_flags(OCFS2_I(inode));
  61. *flags = OCFS2_I(inode)->ip_attr;
  62. ocfs2_inode_unlock(inode, 0);
  63. return status;
  64. }
  65. static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
  66. unsigned mask)
  67. {
  68. struct ocfs2_inode_info *ocfs2_inode = OCFS2_I(inode);
  69. struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
  70. handle_t *handle = NULL;
  71. struct buffer_head *bh = NULL;
  72. unsigned oldflags;
  73. int status;
  74. mutex_lock(&inode->i_mutex);
  75. status = ocfs2_inode_lock(inode, &bh, 1);
  76. if (status < 0) {
  77. mlog_errno(status);
  78. goto bail;
  79. }
  80. status = -EACCES;
  81. if (!inode_owner_or_capable(inode))
  82. goto bail_unlock;
  83. if (!S_ISDIR(inode->i_mode))
  84. flags &= ~OCFS2_DIRSYNC_FL;
  85. handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
  86. if (IS_ERR(handle)) {
  87. status = PTR_ERR(handle);
  88. mlog_errno(status);
  89. goto bail_unlock;
  90. }
  91. oldflags = ocfs2_inode->ip_attr;
  92. flags = flags & mask;
  93. flags |= oldflags & ~mask;
  94. /*
  95. * The IMMUTABLE and APPEND_ONLY flags can only be changed by
  96. * the relevant capability.
  97. */
  98. status = -EPERM;
  99. if ((oldflags & OCFS2_IMMUTABLE_FL) || ((flags ^ oldflags) &
  100. (OCFS2_APPEND_FL | OCFS2_IMMUTABLE_FL))) {
  101. if (!capable(CAP_LINUX_IMMUTABLE))
  102. goto bail_unlock;
  103. }
  104. ocfs2_inode->ip_attr = flags;
  105. ocfs2_set_inode_flags(inode);
  106. status = ocfs2_mark_inode_dirty(handle, inode, bh);
  107. if (status < 0)
  108. mlog_errno(status);
  109. ocfs2_commit_trans(osb, handle);
  110. bail_unlock:
  111. ocfs2_inode_unlock(inode, 1);
  112. bail:
  113. mutex_unlock(&inode->i_mutex);
  114. brelse(bh);
  115. return status;
  116. }
  117. int ocfs2_info_handle_blocksize(struct inode *inode,
  118. struct ocfs2_info_request __user *req)
  119. {
  120. int status = -EFAULT;
  121. struct ocfs2_info_blocksize oib;
  122. if (o2info_from_user(oib, req))
  123. goto bail;
  124. oib.ib_blocksize = inode->i_sb->s_blocksize;
  125. o2info_set_request_filled(&oib.ib_req);
  126. if (o2info_to_user(oib, req))
  127. goto bail;
  128. status = 0;
  129. bail:
  130. if (status)
  131. o2info_set_request_error(&oib.ib_req, req);
  132. return status;
  133. }
  134. int ocfs2_info_handle_clustersize(struct inode *inode,
  135. struct ocfs2_info_request __user *req)
  136. {
  137. int status = -EFAULT;
  138. struct ocfs2_info_clustersize oic;
  139. struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
  140. if (o2info_from_user(oic, req))
  141. goto bail;
  142. oic.ic_clustersize = osb->s_clustersize;
  143. o2info_set_request_filled(&oic.ic_req);
  144. if (o2info_to_user(oic, req))
  145. goto bail;
  146. status = 0;
  147. bail:
  148. if (status)
  149. o2info_set_request_error(&oic.ic_req, req);
  150. return status;
  151. }
  152. int ocfs2_info_handle_maxslots(struct inode *inode,
  153. struct ocfs2_info_request __user *req)
  154. {
  155. int status = -EFAULT;
  156. struct ocfs2_info_maxslots oim;
  157. struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
  158. if (o2info_from_user(oim, req))
  159. goto bail;
  160. oim.im_max_slots = osb->max_slots;
  161. o2info_set_request_filled(&oim.im_req);
  162. if (o2info_to_user(oim, req))
  163. goto bail;
  164. status = 0;
  165. bail:
  166. if (status)
  167. o2info_set_request_error(&oim.im_req, req);
  168. return status;
  169. }
  170. int ocfs2_info_handle_label(struct inode *inode,
  171. struct ocfs2_info_request __user *req)
  172. {
  173. int status = -EFAULT;
  174. struct ocfs2_info_label oil;
  175. struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
  176. if (o2info_from_user(oil, req))
  177. goto bail;
  178. memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN);
  179. o2info_set_request_filled(&oil.il_req);
  180. if (o2info_to_user(oil, req))
  181. goto bail;
  182. status = 0;
  183. bail:
  184. if (status)
  185. o2info_set_request_error(&oil.il_req, req);
  186. return status;
  187. }
  188. int ocfs2_info_handle_uuid(struct inode *inode,
  189. struct ocfs2_info_request __user *req)
  190. {
  191. int status = -EFAULT;
  192. struct ocfs2_info_uuid oiu;
  193. struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
  194. if (o2info_from_user(oiu, req))
  195. goto bail;
  196. memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1);
  197. o2info_set_request_filled(&oiu.iu_req);
  198. if (o2info_to_user(oiu, req))
  199. goto bail;
  200. status = 0;
  201. bail:
  202. if (status)
  203. o2info_set_request_error(&oiu.iu_req, req);
  204. return status;
  205. }
  206. int ocfs2_info_handle_fs_features(struct inode *inode,
  207. struct ocfs2_info_request __user *req)
  208. {
  209. int status = -EFAULT;
  210. struct ocfs2_info_fs_features oif;
  211. struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
  212. if (o2info_from_user(oif, req))
  213. goto bail;
  214. oif.if_compat_features = osb->s_feature_compat;
  215. oif.if_incompat_features = osb->s_feature_incompat;
  216. oif.if_ro_compat_features = osb->s_feature_ro_compat;
  217. o2info_set_request_filled(&oif.if_req);
  218. if (o2info_to_user(oif, req))
  219. goto bail;
  220. status = 0;
  221. bail:
  222. if (status)
  223. o2info_set_request_error(&oif.if_req, req);
  224. return status;
  225. }
  226. int ocfs2_info_handle_journal_size(struct inode *inode,
  227. struct ocfs2_info_request __user *req)
  228. {
  229. int status = -EFAULT;
  230. struct ocfs2_info_journal_size oij;
  231. struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
  232. if (o2info_from_user(oij, req))
  233. goto bail;
  234. oij.ij_journal_size = osb->journal->j_inode->i_size;
  235. o2info_set_request_filled(&oij.ij_req);
  236. if (o2info_to_user(oij, req))
  237. goto bail;
  238. status = 0;
  239. bail:
  240. if (status)
  241. o2info_set_request_error(&oij.ij_req, req);
  242. return status;
  243. }
  244. int ocfs2_info_scan_inode_alloc(struct ocfs2_super *osb,
  245. struct inode *inode_alloc, u64 blkno,
  246. struct ocfs2_info_freeinode *fi, u32 slot)
  247. {
  248. int status = 0, unlock = 0;
  249. struct buffer_head *bh = NULL;
  250. struct ocfs2_dinode *dinode_alloc = NULL;
  251. if (inode_alloc)
  252. mutex_lock(&inode_alloc->i_mutex);
  253. if (o2info_coherent(&fi->ifi_req)) {
  254. status = ocfs2_inode_lock(inode_alloc, &bh, 0);
  255. if (status < 0) {
  256. mlog_errno(status);
  257. goto bail;
  258. }
  259. unlock = 1;
  260. } else {
  261. status = ocfs2_read_blocks_sync(osb, blkno, 1, &bh);
  262. if (status < 0) {
  263. mlog_errno(status);
  264. goto bail;
  265. }
  266. }
  267. dinode_alloc = (struct ocfs2_dinode *)bh->b_data;
  268. fi->ifi_stat[slot].lfi_total =
  269. le32_to_cpu(dinode_alloc->id1.bitmap1.i_total);
  270. fi->ifi_stat[slot].lfi_free =
  271. le32_to_cpu(dinode_alloc->id1.bitmap1.i_total) -
  272. le32_to_cpu(dinode_alloc->id1.bitmap1.i_used);
  273. bail:
  274. if (unlock)
  275. ocfs2_inode_unlock(inode_alloc, 0);
  276. if (inode_alloc)
  277. mutex_unlock(&inode_alloc->i_mutex);
  278. brelse(bh);
  279. return status;
  280. }
  281. int ocfs2_info_handle_freeinode(struct inode *inode,
  282. struct ocfs2_info_request __user *req)
  283. {
  284. u32 i;
  285. u64 blkno = -1;
  286. char namebuf[40];
  287. int status = -EFAULT, type = INODE_ALLOC_SYSTEM_INODE;
  288. struct ocfs2_info_freeinode *oifi = NULL;
  289. struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
  290. struct inode *inode_alloc = NULL;
  291. oifi = kzalloc(sizeof(struct ocfs2_info_freeinode), GFP_KERNEL);
  292. if (!oifi) {
  293. status = -ENOMEM;
  294. mlog_errno(status);
  295. goto bail;
  296. }
  297. if (o2info_from_user(*oifi, req))
  298. goto bail;
  299. oifi->ifi_slotnum = osb->max_slots;
  300. for (i = 0; i < oifi->ifi_slotnum; i++) {
  301. if (o2info_coherent(&oifi->ifi_req)) {
  302. inode_alloc = ocfs2_get_system_file_inode(osb, type, i);
  303. if (!inode_alloc) {
  304. mlog(ML_ERROR, "unable to get alloc inode in "
  305. "slot %u\n", i);
  306. status = -EIO;
  307. goto bail;
  308. }
  309. } else {
  310. ocfs2_sprintf_system_inode_name(namebuf,
  311. sizeof(namebuf),
  312. type, i);
  313. status = ocfs2_lookup_ino_from_name(osb->sys_root_inode,
  314. namebuf,
  315. strlen(namebuf),
  316. &blkno);
  317. if (status < 0) {
  318. status = -ENOENT;
  319. goto bail;
  320. }
  321. }
  322. status = ocfs2_info_scan_inode_alloc(osb, inode_alloc, blkno, oifi, i);
  323. if (status < 0)
  324. goto bail;
  325. iput(inode_alloc);
  326. inode_alloc = NULL;
  327. }
  328. o2info_set_request_filled(&oifi->ifi_req);
  329. if (o2info_to_user(*oifi, req))
  330. goto bail;
  331. status = 0;
  332. bail:
  333. if (status)
  334. o2info_set_request_error(&oifi->ifi_req, req);
  335. kfree(oifi);
  336. return status;
  337. }
  338. int ocfs2_info_handle_unknown(struct inode *inode,
  339. struct ocfs2_info_request __user *req)
  340. {
  341. int status = -EFAULT;
  342. struct ocfs2_info_request oir;
  343. if (o2info_from_user(oir, req))
  344. goto bail;
  345. o2info_clear_request_filled(&oir);
  346. if (o2info_to_user(oir, req))
  347. goto bail;
  348. status = 0;
  349. bail:
  350. if (status)
  351. o2info_set_request_error(&oir, req);
  352. return status;
  353. }
  354. /*
  355. * Validate and distinguish OCFS2_IOC_INFO requests.
  356. *
  357. * - validate the magic number.
  358. * - distinguish different requests.
  359. * - validate size of different requests.
  360. */
  361. int ocfs2_info_handle_request(struct inode *inode,
  362. struct ocfs2_info_request __user *req)
  363. {
  364. int status = -EFAULT;
  365. struct ocfs2_info_request oir;
  366. if (o2info_from_user(oir, req))
  367. goto bail;
  368. status = -EINVAL;
  369. if (oir.ir_magic != OCFS2_INFO_MAGIC)
  370. goto bail;
  371. switch (oir.ir_code) {
  372. case OCFS2_INFO_BLOCKSIZE:
  373. if (oir.ir_size == sizeof(struct ocfs2_info_blocksize))
  374. status = ocfs2_info_handle_blocksize(inode, req);
  375. break;
  376. case OCFS2_INFO_CLUSTERSIZE:
  377. if (oir.ir_size == sizeof(struct ocfs2_info_clustersize))
  378. status = ocfs2_info_handle_clustersize(inode, req);
  379. break;
  380. case OCFS2_INFO_MAXSLOTS:
  381. if (oir.ir_size == sizeof(struct ocfs2_info_maxslots))
  382. status = ocfs2_info_handle_maxslots(inode, req);
  383. break;
  384. case OCFS2_INFO_LABEL:
  385. if (oir.ir_size == sizeof(struct ocfs2_info_label))
  386. status = ocfs2_info_handle_label(inode, req);
  387. break;
  388. case OCFS2_INFO_UUID:
  389. if (oir.ir_size == sizeof(struct ocfs2_info_uuid))
  390. status = ocfs2_info_handle_uuid(inode, req);
  391. break;
  392. case OCFS2_INFO_FS_FEATURES:
  393. if (oir.ir_size == sizeof(struct ocfs2_info_fs_features))
  394. status = ocfs2_info_handle_fs_features(inode, req);
  395. break;
  396. case OCFS2_INFO_JOURNAL_SIZE:
  397. if (oir.ir_size == sizeof(struct ocfs2_info_journal_size))
  398. status = ocfs2_info_handle_journal_size(inode, req);
  399. break;
  400. case OCFS2_INFO_FREEINODE:
  401. if (oir.ir_size == sizeof(struct ocfs2_info_freeinode))
  402. status = ocfs2_info_handle_freeinode(inode, req);
  403. break;
  404. default:
  405. status = ocfs2_info_handle_unknown(inode, req);
  406. break;
  407. }
  408. bail:
  409. return status;
  410. }
  411. int ocfs2_get_request_ptr(struct ocfs2_info *info, int idx,
  412. u64 *req_addr, int compat_flag)
  413. {
  414. int status = -EFAULT;
  415. u64 __user *bp = NULL;
  416. if (compat_flag) {
  417. #ifdef CONFIG_COMPAT
  418. /*
  419. * pointer bp stores the base address of a pointers array,
  420. * which collects all addresses of separate request.
  421. */
  422. bp = (u64 __user *)(unsigned long)compat_ptr(info->oi_requests);
  423. #else
  424. BUG();
  425. #endif
  426. } else
  427. bp = (u64 __user *)(unsigned long)(info->oi_requests);
  428. if (o2info_from_user(*req_addr, bp + idx))
  429. goto bail;
  430. status = 0;
  431. bail:
  432. return status;
  433. }
  434. /*
  435. * OCFS2_IOC_INFO handles an array of requests passed from userspace.
  436. *
  437. * ocfs2_info_handle() recevies a large info aggregation, grab and
  438. * validate the request count from header, then break it into small
  439. * pieces, later specific handlers can handle them one by one.
  440. *
  441. * Idea here is to make each separate request small enough to ensure
  442. * a better backward&forward compatibility, since a small piece of
  443. * request will be less likely to be broken if disk layout get changed.
  444. */
  445. int ocfs2_info_handle(struct inode *inode, struct ocfs2_info *info,
  446. int compat_flag)
  447. {
  448. int i, status = 0;
  449. u64 req_addr;
  450. struct ocfs2_info_request __user *reqp;
  451. if ((info->oi_count > OCFS2_INFO_MAX_REQUEST) ||
  452. (!info->oi_requests)) {
  453. status = -EINVAL;
  454. goto bail;
  455. }
  456. for (i = 0; i < info->oi_count; i++) {
  457. status = ocfs2_get_request_ptr(info, i, &req_addr, compat_flag);
  458. if (status)
  459. break;
  460. reqp = (struct ocfs2_info_request *)(unsigned long)req_addr;
  461. if (!reqp) {
  462. status = -EINVAL;
  463. goto bail;
  464. }
  465. status = ocfs2_info_handle_request(inode, reqp);
  466. if (status)
  467. break;
  468. }
  469. bail:
  470. return status;
  471. }
  472. long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
  473. {
  474. struct inode *inode = filp->f_path.dentry->d_inode;
  475. unsigned int flags;
  476. int new_clusters;
  477. int status;
  478. struct ocfs2_space_resv sr;
  479. struct ocfs2_new_group_input input;
  480. struct reflink_arguments args;
  481. const char *old_path, *new_path;
  482. bool preserve;
  483. struct ocfs2_info info;
  484. switch (cmd) {
  485. case OCFS2_IOC_GETFLAGS:
  486. status = ocfs2_get_inode_attr(inode, &flags);
  487. if (status < 0)
  488. return status;
  489. flags &= OCFS2_FL_VISIBLE;
  490. return put_user(flags, (int __user *) arg);
  491. case OCFS2_IOC_SETFLAGS:
  492. if (get_user(flags, (int __user *) arg))
  493. return -EFAULT;
  494. status = mnt_want_write(filp->f_path.mnt);
  495. if (status)
  496. return status;
  497. status = ocfs2_set_inode_attr(inode, flags,
  498. OCFS2_FL_MODIFIABLE);
  499. mnt_drop_write(filp->f_path.mnt);
  500. return status;
  501. case OCFS2_IOC_RESVSP:
  502. case OCFS2_IOC_RESVSP64:
  503. case OCFS2_IOC_UNRESVSP:
  504. case OCFS2_IOC_UNRESVSP64:
  505. if (copy_from_user(&sr, (int __user *) arg, sizeof(sr)))
  506. return -EFAULT;
  507. return ocfs2_change_file_space(filp, cmd, &sr);
  508. case OCFS2_IOC_GROUP_EXTEND:
  509. if (!capable(CAP_SYS_RESOURCE))
  510. return -EPERM;
  511. if (get_user(new_clusters, (int __user *)arg))
  512. return -EFAULT;
  513. return ocfs2_group_extend(inode, new_clusters);
  514. case OCFS2_IOC_GROUP_ADD:
  515. case OCFS2_IOC_GROUP_ADD64:
  516. if (!capable(CAP_SYS_RESOURCE))
  517. return -EPERM;
  518. if (copy_from_user(&input, (int __user *) arg, sizeof(input)))
  519. return -EFAULT;
  520. return ocfs2_group_add(inode, &input);
  521. case OCFS2_IOC_REFLINK:
  522. if (copy_from_user(&args, (struct reflink_arguments *)arg,
  523. sizeof(args)))
  524. return -EFAULT;
  525. old_path = (const char *)(unsigned long)args.old_path;
  526. new_path = (const char *)(unsigned long)args.new_path;
  527. preserve = (args.preserve != 0);
  528. return ocfs2_reflink_ioctl(inode, old_path, new_path, preserve);
  529. case OCFS2_IOC_INFO:
  530. if (copy_from_user(&info, (struct ocfs2_info __user *)arg,
  531. sizeof(struct ocfs2_info)))
  532. return -EFAULT;
  533. return ocfs2_info_handle(inode, &info, 0);
  534. default:
  535. return -ENOTTY;
  536. }
  537. }
  538. #ifdef CONFIG_COMPAT
  539. long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
  540. {
  541. bool preserve;
  542. struct reflink_arguments args;
  543. struct inode *inode = file->f_path.dentry->d_inode;
  544. struct ocfs2_info info;
  545. switch (cmd) {
  546. case OCFS2_IOC32_GETFLAGS:
  547. cmd = OCFS2_IOC_GETFLAGS;
  548. break;
  549. case OCFS2_IOC32_SETFLAGS:
  550. cmd = OCFS2_IOC_SETFLAGS;
  551. break;
  552. case OCFS2_IOC_RESVSP:
  553. case OCFS2_IOC_RESVSP64:
  554. case OCFS2_IOC_UNRESVSP:
  555. case OCFS2_IOC_UNRESVSP64:
  556. case OCFS2_IOC_GROUP_EXTEND:
  557. case OCFS2_IOC_GROUP_ADD:
  558. case OCFS2_IOC_GROUP_ADD64:
  559. break;
  560. case OCFS2_IOC_REFLINK:
  561. if (copy_from_user(&args, (struct reflink_arguments *)arg,
  562. sizeof(args)))
  563. return -EFAULT;
  564. preserve = (args.preserve != 0);
  565. return ocfs2_reflink_ioctl(inode, compat_ptr(args.old_path),
  566. compat_ptr(args.new_path), preserve);
  567. case OCFS2_IOC_INFO:
  568. if (copy_from_user(&info, (struct ocfs2_info __user *)arg,
  569. sizeof(struct ocfs2_info)))
  570. return -EFAULT;
  571. return ocfs2_info_handle(inode, &info, 1);
  572. default:
  573. return -ENOIOCTLCMD;
  574. }
  575. return ocfs2_ioctl(file, cmd, arg);
  576. }
  577. #endif