source:
freewrt/package/mini_fo/patches/102-mutex_change.patch@
db5651c
| Last change on this file since db5651c was db5651c, checked in by , 19 years ago | |
|---|---|
|
|
| File size: 18.5 KB | |
-
ChangeLog
From: <mk@mary.denx.de> Date: Tue, 24 Jan 2006 14:09:21 +0000 (+0100) Subject: Support for new mutex infrastructure X-Git-Url: http://www.denx.de/cgi-bin/gitweb.cgi?p=mini_fo.git;a=commitdiff;h=1dcc028729060ea83ea662155634b33ae8e2c493 Support for new mutex infrastructure (7892f2f48d165a34b0b8130c8a195dfd807b8cb6) ---
a b 1 2006-01-24 Markus Klotzbuecher <mk@mary.denx.de> 2 3 * Add tons of ugly ifdefs to Ed L. Cashin's mutex patch to 4 retain backwards compatibility. 5 6 2006-01-24 Ed L. Cashin <ecashin@coraid.com> 7 8 * Support for the new mutex infrastructure 9 (7892f2f48d165a34b0b8130c8a195dfd807b8cb6) 10 1 11 2005-10-15 Markus Klotzbuecher <mk@localhost.localdomain> 2 12 3 13 * Bugfix for a serious memory leak in mini_fo_follow_link. -
aux.c
a b int build_sto_structure(dentry_t *dir, d 435 435 436 436 /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ 437 437 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 438 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 439 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 440 #else 438 441 down(&hidden_sto_dir_dentry->d_inode->i_sem); 439 442 #endif 440 443 /* lets be safe */ 441 444 if(dtohd2(dir) != hidden_sto_dir_dentry) { 442 445 printk(KERN_CRIT "mini_fo: build_sto_structure: invalid parameter or meta data corruption [2].\n"); … … int build_sto_structure(dentry_t *dir, d 457 460 if(err) { 458 461 printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [1].\n"); 459 462 /* was: unlock_dir(dir); */ 463 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 464 mutex_unlock(&dir->d_inode->i_mutex); 465 #else 460 466 up(&dir->d_inode->i_sem); 467 #endif 461 468 dput(dir); 462 469 return err; 463 470 } … … int build_sto_structure(dentry_t *dir, d 466 473 if(!dtohd2(dentry)->d_inode) { 467 474 printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [2].\n"); 468 475 /* was: unlock_dir(dir); */ 476 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 477 mutex_unlock(&dir->d_inode->i_mutex); 478 #else 469 479 up(&dir->d_inode->i_sem); 480 #endif 470 481 dput(dir); 471 482 return 1; 472 483 } … … int build_sto_structure(dentry_t *dir, d 485 496 hidden_sto_dir_dentry->d_inode); 486 497 dir->d_inode->i_nlink++; 487 498 /* was: unlock_dir(hidden_sto_dir_dentry); */ 499 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 500 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 501 #else 488 502 up(&hidden_sto_dir_dentry->d_inode->i_sem); 503 #endif 489 504 dput(hidden_sto_dir_dentry); 490 505 return 0; 491 506 } -
file.c
a b mini_fo_fsync(file_t *file, dentry_t *de 613 613 if ((hidden_file = ftohf(file)) != NULL) { 614 614 hidden_dentry = dtohd(dentry); 615 615 if (hidden_file->f_op && hidden_file->f_op->fsync) { 616 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 617 mutex_lock(&hidden_dentry->d_inode->i_mutex); 618 #else 616 619 down(&hidden_dentry->d_inode->i_sem); 620 #endif 617 621 err1 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync); 622 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 623 mutex_unlock(&hidden_dentry->d_inode->i_mutex); 624 #else 618 625 up(&hidden_dentry->d_inode->i_sem); 626 #endif 619 627 } 620 628 } 621 629 622 630 if ((hidden_file = ftohf2(file)) != NULL) { 623 631 hidden_dentry = dtohd2(dentry); 624 632 if (hidden_file->f_op && hidden_file->f_op->fsync) { 633 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 634 mutex_lock(&hidden_dentry->d_inode->i_mutex); 635 #else 625 636 down(&hidden_dentry->d_inode->i_sem); 637 #endif 626 638 err2 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync); 639 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 640 mutex_unlock(&hidden_dentry->d_inode->i_mutex); 641 #else 627 642 up(&hidden_dentry->d_inode->i_sem); 643 #endif 628 644 } 629 645 } 630 646 else -
inode.c
a b mini_fo_link(dentry_t *old_dentry, inode 355 355 356 356 /* was: hidden_dir_dentry = lock_parent(hidden_new_dentry); */ 357 357 hidden_dir_dentry = dget(hidden_new_dentry->d_parent); 358 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 359 mutex_lock(&hidden_dir_dentry->d_inode->i_mutex); 360 #else 358 361 down(&hidden_dir_dentry->d_inode->i_sem); 362 #endif 359 363 360 364 err = vfs_link(hidden_old_dentry, 361 365 hidden_dir_dentry->d_inode, … … mini_fo_link(dentry_t *old_dentry, inode 374 378 375 379 out_lock: 376 380 /* was: unlock_dir(hidden_dir_dentry); */ 381 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 382 mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex); 383 #else 377 384 up(&hidden_dir_dentry->d_inode->i_sem); 385 #endif 378 386 dput(hidden_dir_dentry); 379 387 380 388 dput(hidden_new_dentry); … … mini_fo_symlink(inode_t *dir, dentry_t * 452 460 dget(hidden_sto_dentry); 453 461 /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ 454 462 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 463 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 464 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 465 #else 455 466 down(&hidden_sto_dir_dentry->d_inode->i_sem); 467 #endif 456 468 457 469 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 458 470 mode = S_IALLUGO; … … mini_fo_symlink(inode_t *dir, dentry_t * 481 493 482 494 out_lock: 483 495 /* was: unlock_dir(hidden_sto_dir_dentry); */ 496 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 497 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 498 #else 484 499 up(&hidden_sto_dir_dentry->d_inode->i_sem); 500 #endif 485 501 dput(hidden_sto_dir_dentry); 486 502 487 503 dput(hidden_sto_dentry); … … mini_fo_rmdir(inode_t *dir, dentry_t *de 524 540 525 541 /* was:hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ 526 542 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 543 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 544 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 545 #else 527 546 down(&hidden_sto_dir_dentry->d_inode->i_sem); 547 #endif 528 548 529 549 /* avoid destroying the hidden inode if the file is in use */ 530 550 dget(hidden_sto_dentry); … … mini_fo_rmdir(inode_t *dir, dentry_t *de 572 592 dentry->d_name.len); 573 593 } 574 594 /* was: unlock_dir(hidden_sto_dir_dentry); */ 595 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 596 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 597 #else 575 598 up(&hidden_sto_dir_dentry->d_inode->i_sem); 599 #endif 576 600 dput(hidden_sto_dir_dentry); 577 601 goto out; 578 602 } … … mini_fo_rmdir(inode_t *dir, dentry_t *de 602 626 603 627 /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ 604 628 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 629 630 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 631 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 632 #else 605 633 down(&hidden_sto_dir_dentry->d_inode->i_sem); 634 #endif 606 635 607 636 /* avoid destroying the hidden inode if the file is in use */ 608 637 dget(hidden_sto_dentry); … … mini_fo_rmdir(inode_t *dir, dentry_t *de 630 659 dtopd(dentry)->state = NON_EXISTANT; 631 660 632 661 /* was: unlock_dir(hidden_sto_dir_dentry); */ 662 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 663 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 664 #else 633 665 up(&hidden_sto_dir_dentry->d_inode->i_sem); 666 #endif 634 667 dput(hidden_sto_dir_dentry); 635 668 636 669 goto out; … … mini_fo_rmdir(inode_t *dir, dentry_t *de 641 674 642 675 /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ 643 676 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 677 678 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 679 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 680 #else 644 681 down(&hidden_sto_dir_dentry->d_inode->i_sem); 682 #endif 645 683 646 684 /* avoid destroying the hidden inode if the file is in use */ 647 685 dget(hidden_sto_dentry); … … mini_fo_rmdir(inode_t *dir, dentry_t *de 668 706 dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; 669 707 dtopd(dentry)->state = DELETED; 670 708 /* was: unlock_dir(hidden_sto_dir_dentry); */ 709 710 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 711 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 712 #else 671 713 up(&hidden_sto_dir_dentry->d_inode->i_sem); 714 #endif 672 715 dput(hidden_sto_dir_dentry); 673 716 goto out; 674 717 } … … mini_fo_getxattr(struct dentry *dentry, 1294 1337 encoded_name = (char *)name; 1295 1338 encoded_value = (char *)value; 1296 1339 1340 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 1341 mutex_lock(&hidden_dentry->d_inode->i_mutex); 1342 #else 1297 1343 down(&hidden_dentry->d_inode->i_sem); 1344 #endif 1298 1345 /* lock_kernel() already done by caller. */ 1299 1346 err = hidden_dentry->d_inode->i_op->getxattr(hidden_dentry, encoded_name, encoded_value, size); 1300 1347 /* unlock_kernel() will be done by caller. */ 1348 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 1349 mutex_lock(&hidden_dentry->d_inode->i_mutex); 1350 #else 1301 1351 up(&hidden_dentry->d_inode->i_sem); 1352 #endif 1302 1353 } 1303 1354 return err; 1304 1355 } … … mini_fo_setxattr(struct dentry *dentry, 1340 1391 encoded_name = (char *)name; 1341 1392 encoded_value = (char *)value; 1342 1393 1394 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 1395 mutex_lock(&hidden_dentry->d_inode->i_mutex); 1396 #else 1343 1397 down(&hidden_dentry->d_inode->i_sem); 1398 #endif 1344 1399 /* lock_kernel() already done by caller. */ 1345 1400 err = hidden_dentry->d_inode->i_op->setxattr(hidden_dentry, encoded_name, encoded_value, size, flags); 1346 1401 /* unlock_kernel() will be done by caller. */ 1402 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 1403 mutex_unlock(&hidden_dentry->d_inode->i_mutex); 1404 #else 1347 1405 up(&hidden_dentry->d_inode->i_sem); 1406 #endif 1348 1407 } 1349 1408 return err; 1350 1409 } … … mini_fo_removexattr(struct dentry *dentr 1372 1431 if (hidden_dentry->d_inode->i_op->removexattr) { 1373 1432 encoded_name = (char *)name; 1374 1433 1434 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 1435 mutex_lock(&hidden_dentry->d_inode->i_mutex); 1436 #else 1375 1437 down(&hidden_dentry->d_inode->i_sem); 1438 #endif 1376 1439 /* lock_kernel() already done by caller. */ 1377 1440 err = hidden_dentry->d_inode->i_op->removexattr(hidden_dentry, encoded_name); 1378 1441 /* unlock_kernel() will be done by caller. */ 1442 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 1443 mutex_unlock(&hidden_dentry->d_inode->i_mutex); 1444 #else 1379 1445 up(&hidden_dentry->d_inode->i_sem); 1446 #endif 1380 1447 } 1381 1448 return err; 1382 1449 } … … mini_fo_listxattr(struct dentry *dentry, 1403 1470 1404 1471 if (hidden_dentry->d_inode->i_op->listxattr) { 1405 1472 encoded_list = list; 1473 1474 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 1475 mutex_lock(&hidden_dentry->d_inode->i_mutex); 1476 #else 1406 1477 down(&hidden_dentry->d_inode->i_sem); 1478 #endif 1407 1479 /* lock_kernel() already done by caller. */ 1408 1480 err = hidden_dentry->d_inode->i_op->listxattr(hidden_dentry, encoded_list, size); 1409 1481 /* unlock_kernel() will be done by caller. */ 1482 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 1483 mutex_unlock(&hidden_dentry->d_inode->i_mutex); 1484 #else 1410 1485 up(&hidden_dentry->d_inode->i_sem); 1486 #endif 1411 1487 } 1412 1488 return err; 1413 1489 } -
meta.c
a b int meta_sync_d_list(dentry_t *dentry, i 650 650 struct iattr newattrs; 651 651 newattrs.ia_size = 0; 652 652 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; 653 654 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 655 mutex_lock(&meta_dentry->d_inode->i_mutex); 656 #else 653 657 down(&meta_dentry->d_inode->i_sem); 658 #endif 654 659 err = notify_change(meta_dentry, &newattrs); 660 661 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 662 mutex_unlock(&meta_dentry->d_inode->i_mutex); 663 #else 655 664 up(&meta_dentry->d_inode->i_sem); 665 #endif 666 656 667 if(err || meta_dentry->d_inode->i_size != 0) { 657 668 printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ 658 669 ERROR truncating meta file.\n"); … … int meta_sync_r_list(dentry_t *dentry, i 780 791 struct iattr newattrs; 781 792 newattrs.ia_size = 0; 782 793 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; 794 795 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 796 mutex_lock(&meta_dentry->d_inode->i_mutex); 797 #else 783 798 down(&meta_dentry->d_inode->i_sem); 799 #endif 784 800 err = notify_change(meta_dentry, &newattrs); 801 802 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 803 mutex_unlock(&meta_dentry->d_inode->i_mutex); 804 #else 785 805 up(&meta_dentry->d_inode->i_sem); 806 #endif 786 807 if(err || meta_dentry->d_inode->i_size != 0) { 787 808 printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ 788 809 ERROR truncating meta file.\n"); -
mini_fo.h
a b fist_copy_attr_all(inode_t *dest, const 433 433 434 434 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 435 435 /* copied from linux/fs.h */ 436 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 437 static inline void double_lock(struct dentry *d1, struct dentry *d2) 438 { 439 struct mutex *m1 = &d1->d_inode->i_mutex; 440 struct mutex *m2 = &d2->d_inode->i_mutex; 441 if (m1 != m2) { 442 if ((unsigned long) m1 < (unsigned long) m2) { 443 struct mutex *tmp = m2; 444 m2 = m1; m1 = tmp; 445 } 446 mutex_lock(m1); 447 } 448 mutex_lock(m2); 449 } 450 451 static inline void double_unlock(struct dentry *d1, struct dentry *d2) 452 { 453 struct mutex *m1 = &d1->d_inode->i_mutex; 454 struct mutex *m2 = &d2->d_inode->i_mutex; 455 mutex_unlock(m1); 456 if (m1 != m2) 457 mutex_unlock(m2); 458 dput(d1); 459 dput(d2); 460 } 461 462 #else 436 463 static inline void double_down(struct semaphore *s1, struct semaphore *s2) 437 464 { 438 465 if (s1 != s2) { … … static inline void double_unlock(struct 463 490 dput(d1); 464 491 dput(d2); 465 492 } 466 467 #endif 493 #endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */ 494 #endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ 468 495 #endif /* __KERNEL__ */ 469 496 470 497 /* -
mmap.c
a b mini_fo_commit_write(file_t *file, page_ 478 478 if (ftopd(file) != NULL) 479 479 hidden_file = ftohf(file); 480 480 481 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 482 mutex_lock(&hidden_inode->i_mutex); 483 #else 481 484 down(&hidden_inode->i_sem); 485 #endif 482 486 /* find lower page (returns a locked page) */ 483 487 hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index); 484 488 if (!hidden_page) … … mini_fo_commit_write(file_t *file, page_ 556 560 ClearPageUptodate(page); 557 561 else 558 562 SetPageUptodate(page); 563 564 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 565 mutex_unlock(&hidden_inode->i_mutex); 566 #else 559 567 up(&hidden_inode->i_sem); 568 #endif 560 569 print_exit_status(err); 561 570 return err; /* assume all is ok */ 562 571 } -
state.c
a b int create_sto_reg_file(dentry_t *dentry 44 44 45 45 /* lock parent */ 46 46 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 47 48 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 49 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 50 #else 47 51 down(&hidden_sto_dir_dentry->d_inode->i_sem); 52 #endif 48 53 49 54 err = PTR_ERR(hidden_sto_dir_dentry); 50 55 if (IS_ERR(hidden_sto_dir_dentry)) … … int create_sto_reg_file(dentry_t *dentry 97 102 hidden_sto_dir_dentry->d_inode); 98 103 99 104 out_lock: 105 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 106 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 107 #else 100 108 up(&hidden_sto_dir_dentry->d_inode->i_sem); 109 #endif 101 110 dput(hidden_sto_dir_dentry); 102 111 out: 103 112 return err; … … n"); 130 139 131 140 /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ 132 141 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 142 143 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 144 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 145 #else 133 146 down(&hidden_sto_dir_dentry->d_inode->i_sem); 147 #endif 134 148 135 149 err = PTR_ERR(hidden_sto_dir_dentry); 136 150 if (IS_ERR(hidden_sto_dir_dentry)) … … n"); 184 198 185 199 out_lock: 186 200 /* was: unlock_dir(hidden_sto_dir_dentry); */ 201 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 202 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 203 #else 187 204 up(&hidden_sto_dir_dentry->d_inode->i_sem); 205 #endif 188 206 dput(hidden_sto_dir_dentry); 189 207 out: 190 208 return err; … … int create_sto_nod(dentry_t *dentry, int 217 235 218 236 /* lock parent */ 219 237 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 238 239 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 240 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 241 #else 220 242 down(&hidden_sto_dir_dentry->d_inode->i_sem); 243 #endif 221 244 222 245 err = PTR_ERR(hidden_sto_dir_dentry); 223 246 if (IS_ERR(hidden_sto_dir_dentry)) … … int create_sto_nod(dentry_t *dentry, int 260 283 fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode); 261 284 262 285 out_lock: 286 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 287 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 288 #else 263 289 up(&hidden_sto_dir_dentry->d_inode->i_sem); 290 #endif 264 291 dput(hidden_sto_dir_dentry); 265 292 out: 266 293 return err; … … int nondir_unmod_to_mod(dentry_t *dentry 314 341 315 342 /* lock parent */ 316 343 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 344 345 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 346 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 347 #else 317 348 down(&hidden_sto_dir_dentry->d_inode->i_sem); 349 #endif 318 350 319 351 err = PTR_ERR(hidden_sto_dir_dentry); 320 352 if (IS_ERR(hidden_sto_dir_dentry)) … … int nondir_unmod_to_mod(dentry_t *dentry 365 397 if((cp_flag == 1) && S_ISREG(dentry->d_inode->i_mode)) { 366 398 367 399 /* unlock first */ 400 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 401 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 402 #else 368 403 up(&hidden_sto_dir_dentry->d_inode->i_sem); 404 #endif 405 369 406 dput(hidden_sto_dir_dentry); 370 407 371 408 tgt_dentry = dtohd2(dentry); … … int nondir_unmod_to_mod(dentry_t *dentry 383 420 } 384 421 385 422 out_lock: 423 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 424 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 425 #else 386 426 up(&hidden_sto_dir_dentry->d_inode->i_sem); 427 #endif 387 428 dput(hidden_sto_dir_dentry); 388 429 out: 389 430 return err; … … int nondir_creat_to_del(dentry_t *dentry 420 461 421 462 /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ 422 463 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 464 465 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 466 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 467 #else 423 468 down(&hidden_sto_dir_dentry->d_inode->i_sem); 469 #endif 424 470 425 471 /* avoid destroying the hidden inode if the file is in use */ 426 472 dget(hidden_sto_dentry); … … int nondir_creat_to_del(dentry_t *dentry 435 481 dtost(dentry) = NON_EXISTANT; 436 482 437 483 /* was: unlock_dir(hidden_sto_dir_dentry); */ 484 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 485 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 486 #else 438 487 up(&hidden_sto_dir_dentry->d_inode->i_sem); 488 #endif 439 489 dput(hidden_sto_dir_dentry); 440 490 441 491 out: … … int nondir_mod_to_del(dentry_t *dentry) 464 514 465 515 /* was hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ 466 516 hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); 517 518 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 519 mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); 520 #else 467 521 down(&hidden_sto_dir_dentry->d_inode->i_sem); 522 #endif 468 523 469 524 /* avoid destroying the hidden inode if the file is in use */ 470 525 dget(hidden_sto_dentry); … … int nondir_mod_to_del(dentry_t *dentry) 488 543 dentry->d_name.len); 489 544 490 545 /* was: unlock_dir(hidden_sto_dir_dentry); */ 546 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 547 mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); 548 #else 491 549 up(&hidden_sto_dir_dentry->d_inode->i_sem); 550 #endif 492 551 dput(hidden_sto_dir_dentry); 493 552 494 553 out:
Note:
See TracBrowser
for help on using the repository browser.
