Print this page
OS-3294 add support for inotify
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.

  23  */
  24 
  25 #include <sys/types.h>
  26 #include <sys/t_lock.h>
  27 #include <sys/param.h>
  28 #include <sys/time.h>
  29 #include <sys/systm.h>
  30 #include <sys/sysmacros.h>
  31 #include <sys/resource.h>
  32 #include <sys/signal.h>
  33 #include <sys/cred.h>
  34 #include <sys/user.h>
  35 #include <sys/buf.h>
  36 #include <sys/vfs.h>
  37 #include <sys/stat.h>
  38 #include <sys/vnode.h>
  39 #include <sys/mode.h>
  40 #include <sys/proc.h>
  41 #include <sys/disp.h>
  42 #include <sys/file.h>


 545 out:
 546         if (buf != NULL) {
 547                 kmem_free(buf, udf_vfsp->udf_lbsize);
 548         }
 549         if (slot.fbp) {
 550                 fbrelse(slot.fbp, S_OTHER);
 551         }
 552         rw_exit(&tdp->i_contents);
 553 
 554         if (op == DE_RENAME) {
 555                 /*
 556                  * If it's all good, send events after locks are dropped
 557                  * but before vnodes are released.
 558                  */
 559                 if (err == 0) {
 560                         if (tip) {
 561                                 vnevent_rename_dest(ITOV(tip), ITOV(tdp),
 562                                     namep, ctp);
 563                         }
 564 
 565                         if (sdp != tdp) {
 566                                 vnevent_rename_dest_dir(ITOV(tdp), ctp);
 567                         }
 568                 }
 569 
 570                 /*
 571                  * The following VN_RELE() was moved from the
 572                  * DE_RENAME case above
 573                  */
 574                 if (tip) {
 575                         VN_RELE(ITOV(tip));
 576                 }
 577         }
 578 
 579 out2:
 580         if (err && ((op == DE_LINK) || (op == DE_RENAME))) {
 581                 /*
 582                  * Undo bumped link count.
 583                  */
 584                 rw_enter(&sip->i_contents, RW_WRITER);
 585                 sip->i_nlink--;
 586                 rw_exit(&sip->i_contents);
 587 
 588                 mutex_enter(&sip->i_tlock);




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  24  */
  25 
  26 #include <sys/types.h>
  27 #include <sys/t_lock.h>
  28 #include <sys/param.h>
  29 #include <sys/time.h>
  30 #include <sys/systm.h>
  31 #include <sys/sysmacros.h>
  32 #include <sys/resource.h>
  33 #include <sys/signal.h>
  34 #include <sys/cred.h>
  35 #include <sys/user.h>
  36 #include <sys/buf.h>
  37 #include <sys/vfs.h>
  38 #include <sys/stat.h>
  39 #include <sys/vnode.h>
  40 #include <sys/mode.h>
  41 #include <sys/proc.h>
  42 #include <sys/disp.h>
  43 #include <sys/file.h>


 546 out:
 547         if (buf != NULL) {
 548                 kmem_free(buf, udf_vfsp->udf_lbsize);
 549         }
 550         if (slot.fbp) {
 551                 fbrelse(slot.fbp, S_OTHER);
 552         }
 553         rw_exit(&tdp->i_contents);
 554 
 555         if (op == DE_RENAME) {
 556                 /*
 557                  * If it's all good, send events after locks are dropped
 558                  * but before vnodes are released.
 559                  */
 560                 if (err == 0) {
 561                         if (tip) {
 562                                 vnevent_rename_dest(ITOV(tip), ITOV(tdp),
 563                                     namep, ctp);
 564                         }
 565 
 566                         vnevent_rename_dest_dir(ITOV(tdp), ITOV(tip),
 567                             namep, ctp);
 568                 }

 569 
 570                 /*
 571                  * The following VN_RELE() was moved from the
 572                  * DE_RENAME case above
 573                  */
 574                 if (tip) {
 575                         VN_RELE(ITOV(tip));
 576                 }
 577         }
 578 
 579 out2:
 580         if (err && ((op == DE_LINK) || (op == DE_RENAME))) {
 581                 /*
 582                  * Undo bumped link count.
 583                  */
 584                 rw_enter(&sip->i_contents, RW_WRITER);
 585                 sip->i_nlink--;
 586                 rw_exit(&sip->i_contents);
 587 
 588                 mutex_enter(&sip->i_tlock);