1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * fs/f2fs/namei.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8 #include <linux/fs.h> 9 #include <linux/f2fs_fs.h> 10 #include <linux/pagemap.h> 11 #include <linux/sched.h> 12 #include <linux/ctype.h> 13 #include <linux/random.h> 14 #include <linux/dcache.h> 15 #include <linux/namei.h> 16 #include <linux/quotaops.h> 17 18 #include "f2fs.h" 19 #include "node.h" 20 #include "segment.h" 21 #include "xattr.h" 22 #include "acl.h" 23 #include <trace/events/f2fs.h> 24 25 static inline bool is_extension_exist(const unsigned char *s, const char *sub, 26 bool tmp_ext, bool tmp_dot) 27 { 28 size_t slen = strlen(s); 29 size_t sublen = strlen(sub); 30 int i; 31 32 if (sublen == 1 && *sub == '*') 33 return true; 34 35 /* 36 * filename format of multimedia file should be defined as: 37 * "filename + '.' + extension + (optional: '.' + temp extension)". 38 */ 39 if (slen < sublen + 2) 40 return false; 41 42 if (!tmp_ext) { 43 /* file has no temp extension */ 44 if (s[slen - sublen - 1] != '.') 45 return false; 46 return !strncasecmp(s + slen - sublen, sub, sublen); 47 } 48 49 for (i = 1; i < slen - sublen; i++) { 50 if (s[i] != '.') 51 continue; 52 if (!strncasecmp(s + i + 1, sub, sublen)) { 53 if (!tmp_dot) 54 return true; 55 if (i == slen - sublen - 1 || s[i + 1 + sublen] == '.') 56 return true; 57 } 58 } 59 60 return false; 61 } 62 63 static inline bool is_temperature_extension(const unsigned char *s, const char *sub) 64 { 65 return is_extension_exist(s, sub, true, false); 66 } 67 68 static inline bool is_compress_extension(const unsigned char *s, const char *sub) 69 { 70 return is_extension_exist(s, sub, true, true); 71 } 72 73 int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name, 74 bool hot, bool set) 75 { 76 __u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list; 77 int cold_count = le32_to_cpu(sbi->raw_super->extension_count); 78 int hot_count = sbi->raw_super->hot_ext_count; 79 int total_count = cold_count + hot_count; 80 int start, count; 81 int i; 82 83 if (set) { 84 if (total_count == F2FS_MAX_EXTENSION) 85 return -EINVAL; 86 } else { 87 if (!hot && !cold_count) 88 return -EINVAL; 89 if (hot && !hot_count) 90 return -EINVAL; 91 } 92 93 if (hot) { 94 start = cold_count; 95 count = total_count; 96 } else { 97 start = 0; 98 count = cold_count; 99 } 100 101 for (i = start; i < count; i++) { 102 if (strcmp(name, extlist[i])) 103 continue; 104 105 if (set) 106 return -EINVAL; 107 108 memcpy(extlist[i], extlist[i + 1], 109 F2FS_EXTENSION_LEN * (total_count - i - 1)); 110 memset(extlist[total_count - 1], 0, F2FS_EXTENSION_LEN); 111 if (hot) 112 sbi->raw_super->hot_ext_count = hot_count - 1; 113 else 114 sbi->raw_super->extension_count = 115 cpu_to_le32(cold_count - 1); 116 return 0; 117 } 118 119 if (!set) 120 return -EINVAL; 121 122 if (hot) { 123 memcpy(extlist[count], name, strlen(name)); 124 sbi->raw_super->hot_ext_count = hot_count + 1; 125 } else { 126 char buf[F2FS_MAX_EXTENSION][F2FS_EXTENSION_LEN]; 127 128 memcpy(buf, &extlist[cold_count], 129 F2FS_EXTENSION_LEN * hot_count); 130 memset(extlist[cold_count], 0, F2FS_EXTENSION_LEN); 131 memcpy(extlist[cold_count], name, strlen(name)); 132 memcpy(&extlist[cold_count + 1], buf, 133 F2FS_EXTENSION_LEN * hot_count); 134 sbi->raw_super->extension_count = cpu_to_le32(cold_count + 1); 135 } 136 return 0; 137 } 138 139 static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, 140 struct inode *inode, const unsigned char *name) 141 { 142 __u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list; 143 unsigned char (*noext)[F2FS_EXTENSION_LEN] = 144 F2FS_OPTION(sbi).noextensions; 145 unsigned char (*ext)[F2FS_EXTENSION_LEN] = F2FS_OPTION(sbi).extensions; 146 unsigned char ext_cnt = F2FS_OPTION(sbi).compress_ext_cnt; 147 unsigned char noext_cnt = F2FS_OPTION(sbi).nocompress_ext_cnt; 148 int i, cold_count, hot_count; 149 150 if (!f2fs_sb_has_compression(sbi)) 151 return; 152 153 if (S_ISDIR(inode->i_mode)) 154 goto inherit_comp; 155 156 /* This name comes only from normal files. */ 157 if (!name) 158 return; 159 160 /* Don't compress hot files. */ 161 f2fs_down_read(&sbi->sb_lock); 162 cold_count = le32_to_cpu(sbi->raw_super->extension_count); 163 hot_count = sbi->raw_super->hot_ext_count; 164 for (i = cold_count; i < cold_count + hot_count; i++) 165 if (is_temperature_extension(name, extlist[i])) 166 break; 167 f2fs_up_read(&sbi->sb_lock); 168 if (i < (cold_count + hot_count)) 169 return; 170 171 /* Don't compress unallowed extension. */ 172 for (i = 0; i < noext_cnt; i++) 173 if (is_compress_extension(name, noext[i])) 174 return; 175 176 /* Compress wanting extension. */ 177 for (i = 0; i < ext_cnt; i++) { 178 if (is_compress_extension(name, ext[i])) { 179 set_compress_context(inode); 180 return; 181 } 182 } 183 inherit_comp: 184 /* Inherit the {no-}compression flag in directory */ 185 if (F2FS_I(dir)->i_flags & F2FS_NOCOMP_FL) { 186 F2FS_I(inode)->i_flags |= F2FS_NOCOMP_FL; 187 f2fs_mark_inode_dirty_sync(inode, true); 188 } else if (F2FS_I(dir)->i_flags & F2FS_COMPR_FL) { 189 set_compress_context(inode); 190 } 191 } 192 193 /* 194 * Set file's temperature for hot/cold data separation 195 */ 196 static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, 197 const unsigned char *name) 198 { 199 __u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list; 200 int i, cold_count, hot_count; 201 202 f2fs_down_read(&sbi->sb_lock); 203 cold_count = le32_to_cpu(sbi->raw_super->extension_count); 204 hot_count = sbi->raw_super->hot_ext_count; 205 for (i = 0; i < cold_count + hot_count; i++) 206 if (is_temperature_extension(name, extlist[i])) 207 break; 208 f2fs_up_read(&sbi->sb_lock); 209 210 if (i == cold_count + hot_count) 211 return; 212 213 if (i < cold_count) 214 file_set_cold(inode); 215 else 216 file_set_hot(inode); 217 } 218 219 static struct inode *f2fs_new_inode(struct mnt_idmap *idmap, 220 struct inode *dir, umode_t mode, 221 const char *name) 222 { 223 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 224 struct f2fs_inode_info *fi; 225 nid_t ino; 226 struct inode *inode; 227 bool nid_free = false; 228 bool encrypt = false; 229 int xattr_size = 0; 230 int err; 231 232 inode = new_inode(dir->i_sb); 233 if (!inode) 234 return ERR_PTR(-ENOMEM); 235 236 if (!f2fs_alloc_nid(sbi, &ino)) { 237 err = -ENOSPC; 238 goto fail; 239 } 240 241 nid_free = true; 242 243 inode_init_owner(idmap, inode, dir, mode); 244 245 fi = F2FS_I(inode); 246 inode->i_ino = ino; 247 inode->i_blocks = 0; 248 simple_inode_init_ts(inode); 249 fi->i_crtime = inode_get_mtime(inode); 250 inode->i_generation = get_random_u32(); 251 252 if (S_ISDIR(inode->i_mode)) 253 fi->i_current_depth = 1; 254 255 err = insert_inode_locked(inode); 256 if (err) { 257 err = -EINVAL; 258 goto fail; 259 } 260 261 if (f2fs_sb_has_project_quota(sbi) && 262 (F2FS_I(dir)->i_flags & F2FS_PROJINHERIT_FL)) 263 fi->i_projid = F2FS_I(dir)->i_projid; 264 else 265 fi->i_projid = make_kprojid(&init_user_ns, 266 F2FS_DEF_PROJID); 267 268 err = fscrypt_prepare_new_inode(dir, inode, &encrypt); 269 if (err) 270 goto fail_drop; 271 272 err = f2fs_dquot_initialize(inode); 273 if (err) 274 goto fail_drop; 275 276 set_inode_flag(inode, FI_NEW_INODE); 277 278 if (encrypt) 279 f2fs_set_encrypted_inode(inode); 280 281 if (f2fs_sb_has_extra_attr(sbi)) { 282 set_inode_flag(inode, FI_EXTRA_ATTR); 283 fi->i_extra_isize = F2FS_TOTAL_EXTRA_ATTR_SIZE; 284 } 285 286 if (test_opt(sbi, INLINE_XATTR)) 287 set_inode_flag(inode, FI_INLINE_XATTR); 288 289 if (f2fs_may_inline_dentry(inode)) 290 set_inode_flag(inode, FI_INLINE_DENTRY); 291 292 if (f2fs_sb_has_flexible_inline_xattr(sbi)) { 293 f2fs_bug_on(sbi, !f2fs_has_extra_attr(inode)); 294 if (f2fs_has_inline_xattr(inode)) 295 xattr_size = F2FS_OPTION(sbi).inline_xattr_size; 296 /* Otherwise, will be 0 */ 297 } else if (f2fs_has_inline_xattr(inode) || 298 f2fs_has_inline_dentry(inode)) { 299 xattr_size = DEFAULT_INLINE_XATTR_ADDRS; 300 } 301 fi->i_inline_xattr_size = xattr_size; 302 303 fi->i_flags = 304 f2fs_mask_flags(mode, F2FS_I(dir)->i_flags & F2FS_FL_INHERITED); 305 306 if (S_ISDIR(inode->i_mode)) 307 fi->i_flags |= F2FS_INDEX_FL; 308 309 if (fi->i_flags & F2FS_PROJINHERIT_FL) 310 set_inode_flag(inode, FI_PROJ_INHERIT); 311 312 /* Check compression first. */ 313 set_compress_new_inode(sbi, dir, inode, name); 314 315 /* Should enable inline_data after compression set */ 316 if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode)) 317 set_inode_flag(inode, FI_INLINE_DATA); 318 319 if (name && !test_opt(sbi, DISABLE_EXT_IDENTIFY)) 320 set_file_temperature(sbi, inode, name); 321 322 stat_inc_inline_xattr(inode); 323 stat_inc_inline_inode(inode); 324 stat_inc_inline_dir(inode); 325 326 f2fs_set_inode_flags(inode); 327 328 f2fs_init_extent_tree(inode); 329 330 trace_f2fs_new_inode(inode, 0); 331 return inode; 332 333 fail: 334 trace_f2fs_new_inode(inode, err); 335 make_bad_inode(inode); 336 if (nid_free) 337 set_inode_flag(inode, FI_FREE_NID); 338 iput(inode); 339 return ERR_PTR(err); 340 fail_drop: 341 trace_f2fs_new_inode(inode, err); 342 dquot_drop(inode); 343 inode->i_flags |= S_NOQUOTA; 344 make_bad_inode(inode); 345 if (nid_free) 346 set_inode_flag(inode, FI_FREE_NID); 347 clear_nlink(inode); 348 unlock_new_inode(inode); 349 iput(inode); 350 return ERR_PTR(err); 351 } 352 353 static int f2fs_create(struct mnt_idmap *idmap, struct inode *dir, 354 struct dentry *dentry, umode_t mode, bool excl) 355 { 356 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 357 struct inode *inode; 358 nid_t ino = 0; 359 int err; 360 361 if (unlikely(f2fs_cp_error(sbi))) 362 return -EIO; 363 if (!f2fs_is_checkpoint_ready(sbi)) 364 return -ENOSPC; 365 366 err = f2fs_dquot_initialize(dir); 367 if (err) 368 return err; 369 370 inode = f2fs_new_inode(idmap, dir, mode, dentry->d_name.name); 371 if (IS_ERR(inode)) 372 return PTR_ERR(inode); 373 374 inode->i_op = &f2fs_file_inode_operations; 375 inode->i_fop = &f2fs_file_operations; 376 inode->i_mapping->a_ops = &f2fs_dblock_aops; 377 ino = inode->i_ino; 378 379 f2fs_lock_op(sbi); 380 err = f2fs_add_link(dentry, inode); 381 if (err) 382 goto out; 383 f2fs_unlock_op(sbi); 384 385 f2fs_alloc_nid_done(sbi, ino); 386 387 d_instantiate_new(dentry, inode); 388 389 if (IS_DIRSYNC(dir)) 390 f2fs_sync_fs(sbi->sb, 1); 391 392 f2fs_balance_fs(sbi, true); 393 return 0; 394 out: 395 f2fs_handle_failed_inode(inode); 396 return err; 397 } 398 399 static int f2fs_link(struct dentry *old_dentry, struct inode *dir, 400 struct dentry *dentry) 401 { 402 struct inode *inode = d_inode(old_dentry); 403 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 404 int err; 405 406 if (unlikely(f2fs_cp_error(sbi))) 407 return -EIO; 408 if (!f2fs_is_checkpoint_ready(sbi)) 409 return -ENOSPC; 410 411 err = fscrypt_prepare_link(old_dentry, dir, dentry); 412 if (err) 413 return err; 414 415 if (is_inode_flag_set(dir, FI_PROJ_INHERIT) && 416 (!projid_eq(F2FS_I(dir)->i_projid, 417 F2FS_I(inode)->i_projid))) 418 return -EXDEV; 419 420 err = f2fs_dquot_initialize(dir); 421 if (err) 422 return err; 423 424 f2fs_balance_fs(sbi, true); 425 426 inode_set_ctime_current(inode); 427 ihold(inode); 428 429 set_inode_flag(inode, FI_INC_LINK); 430 f2fs_lock_op(sbi); 431 err = f2fs_add_link(dentry, inode); 432 if (err) 433 goto out; 434 f2fs_unlock_op(sbi); 435 436 d_instantiate(dentry, inode); 437 438 if (IS_DIRSYNC(dir)) 439 f2fs_sync_fs(sbi->sb, 1); 440 return 0; 441 out: 442 clear_inode_flag(inode, FI_INC_LINK); 443 iput(inode); 444 f2fs_unlock_op(sbi); 445 return err; 446 } 447 448 struct dentry *f2fs_get_parent(struct dentry *child) 449 { 450 struct folio *folio; 451 unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot_name, &folio); 452 453 if (!ino) { 454 if (IS_ERR(folio)) 455 return ERR_CAST(folio); 456 return ERR_PTR(-ENOENT); 457 } 458 return d_obtain_alias(f2fs_iget(child->d_sb, ino)); 459 } 460 461 static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, 462 unsigned int flags) 463 { 464 struct inode *inode = NULL; 465 struct f2fs_dir_entry *de; 466 struct folio *folio; 467 struct dentry *new; 468 nid_t ino = -1; 469 int err = 0; 470 struct f2fs_filename fname; 471 472 trace_f2fs_lookup_start(dir, dentry, flags); 473 474 if (dentry->d_name.len > F2FS_NAME_LEN) { 475 err = -ENAMETOOLONG; 476 goto out; 477 } 478 479 err = f2fs_prepare_lookup(dir, dentry, &fname); 480 if (err == -ENOENT) 481 goto out_splice; 482 if (err) 483 goto out; 484 de = __f2fs_find_entry(dir, &fname, &folio); 485 f2fs_free_filename(&fname); 486 487 if (!de) { 488 if (IS_ERR(folio)) { 489 err = PTR_ERR(folio); 490 goto out; 491 } 492 err = -ENOENT; 493 goto out_splice; 494 } 495 496 ino = le32_to_cpu(de->ino); 497 f2fs_folio_put(folio, false); 498 499 inode = f2fs_iget(dir->i_sb, ino); 500 if (IS_ERR(inode)) { 501 err = PTR_ERR(inode); 502 goto out; 503 } 504 505 if (inode->i_nlink == 0) { 506 f2fs_warn(F2FS_I_SB(inode), "%s: inode (ino=%lx) has zero i_nlink", 507 __func__, inode->i_ino); 508 err = -EFSCORRUPTED; 509 set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); 510 goto out_iput; 511 } 512 513 if (IS_ENCRYPTED(dir) && 514 (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) && 515 !fscrypt_has_permitted_context(dir, inode)) { 516 f2fs_warn(F2FS_I_SB(inode), "Inconsistent encryption contexts: %lu/%lu", 517 dir->i_ino, inode->i_ino); 518 err = -EPERM; 519 goto out_iput; 520 } 521 out_splice: 522 if (IS_ENABLED(CONFIG_UNICODE) && !inode && IS_CASEFOLDED(dir)) { 523 /* Eventually we want to call d_add_ci(dentry, NULL) 524 * for negative dentries in the encoding case as 525 * well. For now, prevent the negative dentry 526 * from being cached. 527 */ 528 trace_f2fs_lookup_end(dir, dentry, ino, err); 529 return NULL; 530 } 531 532 new = d_splice_alias(inode, dentry); 533 trace_f2fs_lookup_end(dir, !IS_ERR_OR_NULL(new) ? new : dentry, 534 ino, IS_ERR(new) ? PTR_ERR(new) : err); 535 return new; 536 out_iput: 537 iput(inode); 538 out: 539 trace_f2fs_lookup_end(dir, dentry, ino, err); 540 return ERR_PTR(err); 541 } 542 543 static int f2fs_unlink(struct inode *dir, struct dentry *dentry) 544 { 545 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 546 struct inode *inode = d_inode(dentry); 547 struct f2fs_dir_entry *de; 548 struct folio *folio; 549 int err; 550 551 trace_f2fs_unlink_enter(dir, dentry); 552 553 if (unlikely(f2fs_cp_error(sbi))) { 554 err = -EIO; 555 goto fail; 556 } 557 558 err = f2fs_dquot_initialize(dir); 559 if (err) 560 goto fail; 561 err = f2fs_dquot_initialize(inode); 562 if (err) 563 goto fail; 564 565 de = f2fs_find_entry(dir, &dentry->d_name, &folio); 566 if (!de) { 567 if (IS_ERR(folio)) 568 err = PTR_ERR(folio); 569 goto fail; 570 } 571 572 if (unlikely(inode->i_nlink == 0)) { 573 f2fs_warn(F2FS_I_SB(inode), "%s: inode (ino=%lx) has zero i_nlink", 574 __func__, inode->i_ino); 575 err = -EFSCORRUPTED; 576 set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); 577 f2fs_folio_put(folio, false); 578 goto fail; 579 } 580 581 f2fs_balance_fs(sbi, true); 582 583 f2fs_lock_op(sbi); 584 err = f2fs_acquire_orphan_inode(sbi); 585 if (err) { 586 f2fs_unlock_op(sbi); 587 f2fs_folio_put(folio, false); 588 goto fail; 589 } 590 f2fs_delete_entry(de, folio, dir, inode); 591 f2fs_unlock_op(sbi); 592 593 /* VFS negative dentries are incompatible with Encoding and 594 * Case-insensitiveness. Eventually we'll want avoid 595 * invalidating the dentries here, alongside with returning the 596 * negative dentries at f2fs_lookup(), when it is better 597 * supported by the VFS for the CI case. 598 */ 599 if (IS_ENABLED(CONFIG_UNICODE) && IS_CASEFOLDED(dir)) 600 d_invalidate(dentry); 601 602 if (IS_DIRSYNC(dir)) 603 f2fs_sync_fs(sbi->sb, 1); 604 fail: 605 trace_f2fs_unlink_exit(inode, err); 606 return err; 607 } 608 609 static const char *f2fs_get_link(struct dentry *dentry, 610 struct inode *inode, 611 struct delayed_call *done) 612 { 613 const char *link = page_get_link(dentry, inode, done); 614 615 if (!IS_ERR(link) && !*link) { 616 /* this is broken symlink case */ 617 do_delayed_call(done); 618 clear_delayed_call(done); 619 link = ERR_PTR(-ENOENT); 620 } 621 return link; 622 } 623 624 static int f2fs_symlink(struct mnt_idmap *idmap, struct inode *dir, 625 struct dentry *dentry, const char *symname) 626 { 627 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 628 struct inode *inode; 629 size_t len = strlen(symname); 630 struct fscrypt_str disk_link; 631 int err; 632 633 if (unlikely(f2fs_cp_error(sbi))) 634 return -EIO; 635 if (!f2fs_is_checkpoint_ready(sbi)) 636 return -ENOSPC; 637 638 err = fscrypt_prepare_symlink(dir, symname, len, dir->i_sb->s_blocksize, 639 &disk_link); 640 if (err) 641 return err; 642 643 err = f2fs_dquot_initialize(dir); 644 if (err) 645 return err; 646 647 inode = f2fs_new_inode(idmap, dir, S_IFLNK | S_IRWXUGO, NULL); 648 if (IS_ERR(inode)) 649 return PTR_ERR(inode); 650 651 if (IS_ENCRYPTED(inode)) 652 inode->i_op = &f2fs_encrypted_symlink_inode_operations; 653 else 654 inode->i_op = &f2fs_symlink_inode_operations; 655 inode_nohighmem(inode); 656 inode->i_mapping->a_ops = &f2fs_dblock_aops; 657 658 f2fs_lock_op(sbi); 659 err = f2fs_add_link(dentry, inode); 660 if (err) 661 goto out_f2fs_handle_failed_inode; 662 f2fs_unlock_op(sbi); 663 f2fs_alloc_nid_done(sbi, inode->i_ino); 664 665 err = fscrypt_encrypt_symlink(inode, symname, len, &disk_link); 666 if (err) 667 goto err_out; 668 669 err = page_symlink(inode, disk_link.name, disk_link.len); 670 671 err_out: 672 d_instantiate_new(dentry, inode); 673 674 /* 675 * Let's flush symlink data in order to avoid broken symlink as much as 676 * possible. Nevertheless, fsyncing is the best way, but there is no 677 * way to get a file descriptor in order to flush that. 678 * 679 * Note that, it needs to do dir->fsync to make this recoverable. 680 * If the symlink path is stored into inline_data, there is no 681 * performance regression. 682 */ 683 if (!err) { 684 filemap_write_and_wait_range(inode->i_mapping, 0, 685 disk_link.len - 1); 686 687 if (IS_DIRSYNC(dir)) 688 f2fs_sync_fs(sbi->sb, 1); 689 } else { 690 f2fs_unlink(dir, dentry); 691 } 692 693 f2fs_balance_fs(sbi, true); 694 goto out_free_encrypted_link; 695 696 out_f2fs_handle_failed_inode: 697 f2fs_handle_failed_inode(inode); 698 out_free_encrypted_link: 699 if (disk_link.name != (unsigned char *)symname) 700 kfree(disk_link.name); 701 return err; 702 } 703 704 static struct dentry *f2fs_mkdir(struct mnt_idmap *idmap, struct inode *dir, 705 struct dentry *dentry, umode_t mode) 706 { 707 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 708 struct inode *inode; 709 int err; 710 711 if (unlikely(f2fs_cp_error(sbi))) 712 return ERR_PTR(-EIO); 713 714 err = f2fs_dquot_initialize(dir); 715 if (err) 716 return ERR_PTR(err); 717 718 inode = f2fs_new_inode(idmap, dir, S_IFDIR | mode, NULL); 719 if (IS_ERR(inode)) 720 return ERR_CAST(inode); 721 722 inode->i_op = &f2fs_dir_inode_operations; 723 inode->i_fop = &f2fs_dir_operations; 724 inode->i_mapping->a_ops = &f2fs_dblock_aops; 725 mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); 726 727 set_inode_flag(inode, FI_INC_LINK); 728 f2fs_lock_op(sbi); 729 err = f2fs_add_link(dentry, inode); 730 if (err) 731 goto out_fail; 732 f2fs_unlock_op(sbi); 733 734 f2fs_alloc_nid_done(sbi, inode->i_ino); 735 736 d_instantiate_new(dentry, inode); 737 738 if (IS_DIRSYNC(dir)) 739 f2fs_sync_fs(sbi->sb, 1); 740 741 f2fs_balance_fs(sbi, true); 742 return NULL; 743 744 out_fail: 745 clear_inode_flag(inode, FI_INC_LINK); 746 f2fs_handle_failed_inode(inode); 747 return ERR_PTR(err); 748 } 749 750 static int f2fs_rmdir(struct inode *dir, struct dentry *dentry) 751 { 752 struct inode *inode = d_inode(dentry); 753 754 if (f2fs_empty_dir(inode)) 755 return f2fs_unlink(dir, dentry); 756 return -ENOTEMPTY; 757 } 758 759 static int f2fs_mknod(struct mnt_idmap *idmap, struct inode *dir, 760 struct dentry *dentry, umode_t mode, dev_t rdev) 761 { 762 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 763 struct inode *inode; 764 int err = 0; 765 766 if (unlikely(f2fs_cp_error(sbi))) 767 return -EIO; 768 if (!f2fs_is_checkpoint_ready(sbi)) 769 return -ENOSPC; 770 771 err = f2fs_dquot_initialize(dir); 772 if (err) 773 return err; 774 775 inode = f2fs_new_inode(idmap, dir, mode, NULL); 776 if (IS_ERR(inode)) 777 return PTR_ERR(inode); 778 779 init_special_inode(inode, inode->i_mode, rdev); 780 inode->i_op = &f2fs_special_inode_operations; 781 782 f2fs_lock_op(sbi); 783 err = f2fs_add_link(dentry, inode); 784 if (err) 785 goto out; 786 f2fs_unlock_op(sbi); 787 788 f2fs_alloc_nid_done(sbi, inode->i_ino); 789 790 d_instantiate_new(dentry, inode); 791 792 if (IS_DIRSYNC(dir)) 793 f2fs_sync_fs(sbi->sb, 1); 794 795 f2fs_balance_fs(sbi, true); 796 return 0; 797 out: 798 f2fs_handle_failed_inode(inode); 799 return err; 800 } 801 802 static int __f2fs_tmpfile(struct mnt_idmap *idmap, struct inode *dir, 803 struct file *file, umode_t mode, bool is_whiteout, 804 struct inode **new_inode, struct f2fs_filename *fname) 805 { 806 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 807 struct inode *inode; 808 int err; 809 810 err = f2fs_dquot_initialize(dir); 811 if (err) 812 return err; 813 814 inode = f2fs_new_inode(idmap, dir, mode, NULL); 815 if (IS_ERR(inode)) 816 return PTR_ERR(inode); 817 818 if (is_whiteout) { 819 init_special_inode(inode, inode->i_mode, WHITEOUT_DEV); 820 inode->i_op = &f2fs_special_inode_operations; 821 } else { 822 inode->i_op = &f2fs_file_inode_operations; 823 inode->i_fop = &f2fs_file_operations; 824 inode->i_mapping->a_ops = &f2fs_dblock_aops; 825 } 826 827 f2fs_lock_op(sbi); 828 err = f2fs_acquire_orphan_inode(sbi); 829 if (err) 830 goto out; 831 832 err = f2fs_do_tmpfile(inode, dir, fname); 833 if (err) 834 goto release_out; 835 836 /* 837 * add this non-linked tmpfile to orphan list, in this way we could 838 * remove all unused data of tmpfile after abnormal power-off. 839 */ 840 f2fs_add_orphan_inode(inode); 841 f2fs_alloc_nid_done(sbi, inode->i_ino); 842 843 if (is_whiteout) { 844 f2fs_i_links_write(inode, false); 845 846 spin_lock(&inode->i_lock); 847 inode->i_state |= I_LINKABLE; 848 spin_unlock(&inode->i_lock); 849 } else { 850 if (file) 851 d_tmpfile(file, inode); 852 else 853 f2fs_i_links_write(inode, false); 854 } 855 /* link_count was changed by d_tmpfile as well. */ 856 f2fs_unlock_op(sbi); 857 unlock_new_inode(inode); 858 859 if (new_inode) 860 *new_inode = inode; 861 862 f2fs_balance_fs(sbi, true); 863 return 0; 864 865 release_out: 866 f2fs_release_orphan_inode(sbi); 867 out: 868 f2fs_handle_failed_inode(inode); 869 return err; 870 } 871 872 static int f2fs_tmpfile(struct mnt_idmap *idmap, struct inode *dir, 873 struct file *file, umode_t mode) 874 { 875 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 876 int err; 877 878 if (unlikely(f2fs_cp_error(sbi))) 879 return -EIO; 880 if (!f2fs_is_checkpoint_ready(sbi)) 881 return -ENOSPC; 882 883 err = __f2fs_tmpfile(idmap, dir, file, mode, false, NULL, NULL); 884 885 return finish_open_simple(file, err); 886 } 887 888 static int f2fs_create_whiteout(struct mnt_idmap *idmap, 889 struct inode *dir, struct inode **whiteout, 890 struct f2fs_filename *fname) 891 { 892 return __f2fs_tmpfile(idmap, dir, NULL, S_IFCHR | WHITEOUT_MODE, 893 true, whiteout, fname); 894 } 895 896 int f2fs_get_tmpfile(struct mnt_idmap *idmap, struct inode *dir, 897 struct inode **new_inode) 898 { 899 return __f2fs_tmpfile(idmap, dir, NULL, S_IFREG, 900 false, new_inode, NULL); 901 } 902 903 static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir, 904 struct dentry *old_dentry, struct inode *new_dir, 905 struct dentry *new_dentry, unsigned int flags) 906 { 907 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); 908 struct inode *old_inode = d_inode(old_dentry); 909 struct inode *new_inode = d_inode(new_dentry); 910 struct inode *whiteout = NULL; 911 struct folio *old_dir_folio = NULL; 912 struct folio *old_folio, *new_folio = NULL; 913 struct f2fs_dir_entry *old_dir_entry = NULL; 914 struct f2fs_dir_entry *old_entry; 915 struct f2fs_dir_entry *new_entry; 916 bool old_is_dir = S_ISDIR(old_inode->i_mode); 917 int err; 918 919 if (unlikely(f2fs_cp_error(sbi))) 920 return -EIO; 921 if (!f2fs_is_checkpoint_ready(sbi)) 922 return -ENOSPC; 923 924 if (is_inode_flag_set(new_dir, FI_PROJ_INHERIT) && 925 (!projid_eq(F2FS_I(new_dir)->i_projid, 926 F2FS_I(old_inode)->i_projid))) 927 return -EXDEV; 928 929 /* 930 * If new_inode is null, the below renaming flow will 931 * add a link in old_dir which can convert inline_dir. 932 * After then, if we failed to get the entry due to other 933 * reasons like ENOMEM, we had to remove the new entry. 934 * Instead of adding such the error handling routine, let's 935 * simply convert first here. 936 */ 937 if (old_dir == new_dir && !new_inode) { 938 err = f2fs_try_convert_inline_dir(old_dir, new_dentry); 939 if (err) 940 return err; 941 } 942 943 if (flags & RENAME_WHITEOUT) { 944 struct f2fs_filename fname; 945 946 err = f2fs_setup_filename(old_dir, &old_dentry->d_name, 947 0, &fname); 948 if (err) 949 return err; 950 951 err = f2fs_create_whiteout(idmap, old_dir, &whiteout, &fname); 952 if (err) 953 return err; 954 } 955 956 err = f2fs_dquot_initialize(old_dir); 957 if (err) 958 goto out; 959 960 err = f2fs_dquot_initialize(new_dir); 961 if (err) 962 goto out; 963 964 if (new_inode) { 965 err = f2fs_dquot_initialize(new_inode); 966 if (err) 967 goto out; 968 } 969 970 err = -ENOENT; 971 old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_folio); 972 if (!old_entry) { 973 if (IS_ERR(old_folio)) 974 err = PTR_ERR(old_folio); 975 goto out; 976 } 977 978 if (old_is_dir && old_dir != new_dir) { 979 old_dir_entry = f2fs_parent_dir(old_inode, &old_dir_folio); 980 if (!old_dir_entry) { 981 if (IS_ERR(old_dir_folio)) 982 err = PTR_ERR(old_dir_folio); 983 goto out_old; 984 } 985 } 986 987 if (new_inode) { 988 989 err = -ENOTEMPTY; 990 if (old_is_dir && !f2fs_empty_dir(new_inode)) 991 goto out_dir; 992 993 err = -ENOENT; 994 new_entry = f2fs_find_entry(new_dir, &new_dentry->d_name, 995 &new_folio); 996 if (!new_entry) { 997 if (IS_ERR(new_folio)) 998 err = PTR_ERR(new_folio); 999 goto out_dir; 1000 } 1001 1002 f2fs_balance_fs(sbi, true); 1003 1004 f2fs_lock_op(sbi); 1005 1006 err = f2fs_acquire_orphan_inode(sbi); 1007 if (err) 1008 goto put_out_dir; 1009 1010 f2fs_set_link(new_dir, new_entry, new_folio, old_inode); 1011 new_folio = NULL; 1012 1013 inode_set_ctime_current(new_inode); 1014 f2fs_down_write(&F2FS_I(new_inode)->i_sem); 1015 if (old_is_dir) 1016 f2fs_i_links_write(new_inode, false); 1017 f2fs_i_links_write(new_inode, false); 1018 f2fs_up_write(&F2FS_I(new_inode)->i_sem); 1019 1020 if (!new_inode->i_nlink) 1021 f2fs_add_orphan_inode(new_inode); 1022 else 1023 f2fs_release_orphan_inode(sbi); 1024 } else { 1025 f2fs_balance_fs(sbi, true); 1026 1027 f2fs_lock_op(sbi); 1028 1029 err = f2fs_add_link(new_dentry, old_inode); 1030 if (err) { 1031 f2fs_unlock_op(sbi); 1032 goto out_dir; 1033 } 1034 1035 if (old_is_dir) 1036 f2fs_i_links_write(new_dir, true); 1037 } 1038 1039 f2fs_down_write(&F2FS_I(old_inode)->i_sem); 1040 if (!old_is_dir || whiteout) 1041 file_lost_pino(old_inode); 1042 else 1043 /* adjust dir's i_pino to pass fsck check */ 1044 f2fs_i_pino_write(old_inode, new_dir->i_ino); 1045 f2fs_up_write(&F2FS_I(old_inode)->i_sem); 1046 1047 inode_set_ctime_current(old_inode); 1048 f2fs_mark_inode_dirty_sync(old_inode, false); 1049 1050 f2fs_delete_entry(old_entry, old_folio, old_dir, NULL); 1051 old_folio = NULL; 1052 1053 if (whiteout) { 1054 set_inode_flag(whiteout, FI_INC_LINK); 1055 err = f2fs_add_link(old_dentry, whiteout); 1056 if (err) 1057 goto put_out_dir; 1058 1059 spin_lock(&whiteout->i_lock); 1060 whiteout->i_state &= ~I_LINKABLE; 1061 spin_unlock(&whiteout->i_lock); 1062 1063 iput(whiteout); 1064 } 1065 1066 if (old_dir_entry) 1067 f2fs_set_link(old_inode, old_dir_entry, old_dir_folio, new_dir); 1068 if (old_is_dir) 1069 f2fs_i_links_write(old_dir, false); 1070 1071 if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) { 1072 f2fs_add_ino_entry(sbi, new_dir->i_ino, TRANS_DIR_INO); 1073 if (S_ISDIR(old_inode->i_mode)) 1074 f2fs_add_ino_entry(sbi, old_inode->i_ino, 1075 TRANS_DIR_INO); 1076 } 1077 1078 f2fs_unlock_op(sbi); 1079 1080 if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir)) 1081 f2fs_sync_fs(sbi->sb, 1); 1082 1083 f2fs_update_time(sbi, REQ_TIME); 1084 return 0; 1085 1086 put_out_dir: 1087 f2fs_unlock_op(sbi); 1088 f2fs_folio_put(new_folio, false); 1089 out_dir: 1090 if (old_dir_entry) 1091 f2fs_folio_put(old_dir_folio, false); 1092 out_old: 1093 f2fs_folio_put(old_folio, false); 1094 out: 1095 iput(whiteout); 1096 return err; 1097 } 1098 1099 static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, 1100 struct inode *new_dir, struct dentry *new_dentry) 1101 { 1102 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); 1103 struct inode *old_inode = d_inode(old_dentry); 1104 struct inode *new_inode = d_inode(new_dentry); 1105 struct folio *old_dir_folio, *new_dir_folio; 1106 struct folio *old_folio, *new_folio; 1107 struct f2fs_dir_entry *old_dir_entry = NULL, *new_dir_entry = NULL; 1108 struct f2fs_dir_entry *old_entry, *new_entry; 1109 int old_nlink = 0, new_nlink = 0; 1110 int err; 1111 1112 if (unlikely(f2fs_cp_error(sbi))) 1113 return -EIO; 1114 if (!f2fs_is_checkpoint_ready(sbi)) 1115 return -ENOSPC; 1116 1117 if ((is_inode_flag_set(new_dir, FI_PROJ_INHERIT) && 1118 !projid_eq(F2FS_I(new_dir)->i_projid, 1119 F2FS_I(old_inode)->i_projid)) || 1120 (is_inode_flag_set(old_dir, FI_PROJ_INHERIT) && 1121 !projid_eq(F2FS_I(old_dir)->i_projid, 1122 F2FS_I(new_inode)->i_projid))) 1123 return -EXDEV; 1124 1125 err = f2fs_dquot_initialize(old_dir); 1126 if (err) 1127 goto out; 1128 1129 err = f2fs_dquot_initialize(new_dir); 1130 if (err) 1131 goto out; 1132 1133 err = -ENOENT; 1134 old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_folio); 1135 if (!old_entry) { 1136 if (IS_ERR(old_folio)) 1137 err = PTR_ERR(old_folio); 1138 goto out; 1139 } 1140 1141 new_entry = f2fs_find_entry(new_dir, &new_dentry->d_name, &new_folio); 1142 if (!new_entry) { 1143 if (IS_ERR(new_folio)) 1144 err = PTR_ERR(new_folio); 1145 goto out_old; 1146 } 1147 1148 /* prepare for updating ".." directory entry info later */ 1149 if (old_dir != new_dir) { 1150 if (S_ISDIR(old_inode->i_mode)) { 1151 old_dir_entry = f2fs_parent_dir(old_inode, 1152 &old_dir_folio); 1153 if (!old_dir_entry) { 1154 if (IS_ERR(old_dir_folio)) 1155 err = PTR_ERR(old_dir_folio); 1156 goto out_new; 1157 } 1158 } 1159 1160 if (S_ISDIR(new_inode->i_mode)) { 1161 new_dir_entry = f2fs_parent_dir(new_inode, 1162 &new_dir_folio); 1163 if (!new_dir_entry) { 1164 if (IS_ERR(new_dir_folio)) 1165 err = PTR_ERR(new_dir_folio); 1166 goto out_old_dir; 1167 } 1168 } 1169 } 1170 1171 /* 1172 * If cross rename between file and directory those are not 1173 * in the same directory, we will inc nlink of file's parent 1174 * later, so we should check upper boundary of its nlink. 1175 */ 1176 if ((!old_dir_entry || !new_dir_entry) && 1177 old_dir_entry != new_dir_entry) { 1178 old_nlink = old_dir_entry ? -1 : 1; 1179 new_nlink = -old_nlink; 1180 err = -EMLINK; 1181 if ((old_nlink > 0 && old_dir->i_nlink >= F2FS_LINK_MAX) || 1182 (new_nlink > 0 && new_dir->i_nlink >= F2FS_LINK_MAX)) 1183 goto out_new_dir; 1184 } 1185 1186 f2fs_balance_fs(sbi, true); 1187 1188 f2fs_lock_op(sbi); 1189 1190 /* update ".." directory entry info of old dentry */ 1191 if (old_dir_entry) 1192 f2fs_set_link(old_inode, old_dir_entry, old_dir_folio, new_dir); 1193 1194 /* update ".." directory entry info of new dentry */ 1195 if (new_dir_entry) 1196 f2fs_set_link(new_inode, new_dir_entry, new_dir_folio, old_dir); 1197 1198 /* update directory entry info of old dir inode */ 1199 f2fs_set_link(old_dir, old_entry, old_folio, new_inode); 1200 1201 f2fs_down_write(&F2FS_I(old_inode)->i_sem); 1202 if (!old_dir_entry) 1203 file_lost_pino(old_inode); 1204 else 1205 /* adjust dir's i_pino to pass fsck check */ 1206 f2fs_i_pino_write(old_inode, new_dir->i_ino); 1207 f2fs_up_write(&F2FS_I(old_inode)->i_sem); 1208 1209 inode_set_ctime_current(old_dir); 1210 if (old_nlink) { 1211 f2fs_down_write(&F2FS_I(old_dir)->i_sem); 1212 f2fs_i_links_write(old_dir, old_nlink > 0); 1213 f2fs_up_write(&F2FS_I(old_dir)->i_sem); 1214 } 1215 f2fs_mark_inode_dirty_sync(old_dir, false); 1216 1217 /* update directory entry info of new dir inode */ 1218 f2fs_set_link(new_dir, new_entry, new_folio, old_inode); 1219 1220 f2fs_down_write(&F2FS_I(new_inode)->i_sem); 1221 if (!new_dir_entry) 1222 file_lost_pino(new_inode); 1223 else 1224 /* adjust dir's i_pino to pass fsck check */ 1225 f2fs_i_pino_write(new_inode, old_dir->i_ino); 1226 f2fs_up_write(&F2FS_I(new_inode)->i_sem); 1227 1228 inode_set_ctime_current(new_dir); 1229 if (new_nlink) { 1230 f2fs_down_write(&F2FS_I(new_dir)->i_sem); 1231 f2fs_i_links_write(new_dir, new_nlink > 0); 1232 f2fs_up_write(&F2FS_I(new_dir)->i_sem); 1233 } 1234 f2fs_mark_inode_dirty_sync(new_dir, false); 1235 1236 if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) { 1237 f2fs_add_ino_entry(sbi, old_dir->i_ino, TRANS_DIR_INO); 1238 f2fs_add_ino_entry(sbi, new_dir->i_ino, TRANS_DIR_INO); 1239 } 1240 1241 f2fs_unlock_op(sbi); 1242 1243 if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir)) 1244 f2fs_sync_fs(sbi->sb, 1); 1245 1246 f2fs_update_time(sbi, REQ_TIME); 1247 return 0; 1248 out_new_dir: 1249 if (new_dir_entry) { 1250 f2fs_folio_put(new_dir_folio, 0); 1251 } 1252 out_old_dir: 1253 if (old_dir_entry) { 1254 f2fs_folio_put(old_dir_folio, 0); 1255 } 1256 out_new: 1257 f2fs_folio_put(new_folio, false); 1258 out_old: 1259 f2fs_folio_put(old_folio, false); 1260 out: 1261 return err; 1262 } 1263 1264 static int f2fs_rename2(struct mnt_idmap *idmap, 1265 struct inode *old_dir, struct dentry *old_dentry, 1266 struct inode *new_dir, struct dentry *new_dentry, 1267 unsigned int flags) 1268 { 1269 int err; 1270 1271 if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) 1272 return -EINVAL; 1273 1274 trace_f2fs_rename_start(old_dir, old_dentry, new_dir, new_dentry, 1275 flags); 1276 1277 err = fscrypt_prepare_rename(old_dir, old_dentry, new_dir, new_dentry, 1278 flags); 1279 if (err) 1280 return err; 1281 1282 if (flags & RENAME_EXCHANGE) 1283 err = f2fs_cross_rename(old_dir, old_dentry, 1284 new_dir, new_dentry); 1285 else 1286 /* 1287 * VFS has already handled the new dentry existence case, 1288 * here, we just deal with "RENAME_NOREPLACE" as regular rename. 1289 */ 1290 err = f2fs_rename(idmap, old_dir, old_dentry, 1291 new_dir, new_dentry, flags); 1292 1293 trace_f2fs_rename_end(old_dentry, new_dentry, flags, err); 1294 return err; 1295 } 1296 1297 static const char *f2fs_encrypted_get_link(struct dentry *dentry, 1298 struct inode *inode, 1299 struct delayed_call *done) 1300 { 1301 struct folio *folio; 1302 const char *target; 1303 1304 if (!dentry) 1305 return ERR_PTR(-ECHILD); 1306 1307 folio = read_mapping_folio(inode->i_mapping, 0, NULL); 1308 if (IS_ERR(folio)) 1309 return ERR_CAST(folio); 1310 1311 target = fscrypt_get_symlink(inode, folio_address(folio), 1312 inode->i_sb->s_blocksize, done); 1313 folio_put(folio); 1314 return target; 1315 } 1316 1317 static int f2fs_encrypted_symlink_getattr(struct mnt_idmap *idmap, 1318 const struct path *path, 1319 struct kstat *stat, u32 request_mask, 1320 unsigned int query_flags) 1321 { 1322 f2fs_getattr(idmap, path, stat, request_mask, query_flags); 1323 1324 return fscrypt_symlink_getattr(path, stat); 1325 } 1326 1327 const struct inode_operations f2fs_encrypted_symlink_inode_operations = { 1328 .get_link = f2fs_encrypted_get_link, 1329 .getattr = f2fs_encrypted_symlink_getattr, 1330 .setattr = f2fs_setattr, 1331 .listxattr = f2fs_listxattr, 1332 }; 1333 1334 const struct inode_operations f2fs_dir_inode_operations = { 1335 .create = f2fs_create, 1336 .lookup = f2fs_lookup, 1337 .link = f2fs_link, 1338 .unlink = f2fs_unlink, 1339 .symlink = f2fs_symlink, 1340 .mkdir = f2fs_mkdir, 1341 .rmdir = f2fs_rmdir, 1342 .mknod = f2fs_mknod, 1343 .rename = f2fs_rename2, 1344 .tmpfile = f2fs_tmpfile, 1345 .getattr = f2fs_getattr, 1346 .setattr = f2fs_setattr, 1347 .get_inode_acl = f2fs_get_acl, 1348 .set_acl = f2fs_set_acl, 1349 .listxattr = f2fs_listxattr, 1350 .fiemap = f2fs_fiemap, 1351 .fileattr_get = f2fs_fileattr_get, 1352 .fileattr_set = f2fs_fileattr_set, 1353 }; 1354 1355 const struct inode_operations f2fs_symlink_inode_operations = { 1356 .get_link = f2fs_get_link, 1357 .getattr = f2fs_getattr, 1358 .setattr = f2fs_setattr, 1359 .listxattr = f2fs_listxattr, 1360 }; 1361 1362 const struct inode_operations f2fs_special_inode_operations = { 1363 .getattr = f2fs_getattr, 1364 .setattr = f2fs_setattr, 1365 .get_inode_acl = f2fs_get_acl, 1366 .set_acl = f2fs_set_acl, 1367 .listxattr = f2fs_listxattr, 1368 }; 1369