@@ -537,8 +537,7 @@ int fsnotify_compare_groups(struct fsnotify_group *a, struct fsnotify_group *b)
537537}
538538
539539static int fsnotify_attach_connector_to_object (fsnotify_connp_t * connp ,
540- unsigned int obj_type ,
541- __kernel_fsid_t * fsid )
540+ unsigned int obj_type )
542541{
543542 struct fsnotify_mark_connector * conn ;
544543
@@ -550,14 +549,7 @@ static int fsnotify_attach_connector_to_object(fsnotify_connp_t *connp,
550549 conn -> flags = 0 ;
551550 conn -> type = obj_type ;
552551 conn -> obj = connp ;
553- /* Cache fsid of filesystem containing the object */
554- if (fsid ) {
555- conn -> fsid = * fsid ;
556- conn -> flags = FSNOTIFY_CONN_FLAG_HAS_FSID ;
557- } else {
558- conn -> fsid .val [0 ] = conn -> fsid .val [1 ] = 0 ;
559- conn -> flags = 0 ;
560- }
552+ conn -> flags = 0 ;
561553 fsnotify_get_sb_connectors (conn );
562554
563555 /*
@@ -608,8 +600,7 @@ static struct fsnotify_mark_connector *fsnotify_grab_connector(
608600 */
609601static int fsnotify_add_mark_list (struct fsnotify_mark * mark ,
610602 fsnotify_connp_t * connp ,
611- unsigned int obj_type ,
612- int add_flags , __kernel_fsid_t * fsid )
603+ unsigned int obj_type , int add_flags )
613604{
614605 struct fsnotify_mark * lmark , * last = NULL ;
615606 struct fsnotify_mark_connector * conn ;
@@ -619,41 +610,15 @@ static int fsnotify_add_mark_list(struct fsnotify_mark *mark,
619610 if (WARN_ON (!fsnotify_valid_obj_type (obj_type )))
620611 return - EINVAL ;
621612
622- /* Backend is expected to check for zero fsid (e.g. tmpfs) */
623- if (fsid && WARN_ON_ONCE (!fsid -> val [0 ] && !fsid -> val [1 ]))
624- return - ENODEV ;
625-
626613restart :
627614 spin_lock (& mark -> lock );
628615 conn = fsnotify_grab_connector (connp );
629616 if (!conn ) {
630617 spin_unlock (& mark -> lock );
631- err = fsnotify_attach_connector_to_object (connp , obj_type ,
632- fsid );
618+ err = fsnotify_attach_connector_to_object (connp , obj_type );
633619 if (err )
634620 return err ;
635621 goto restart ;
636- } else if (fsid && !(conn -> flags & FSNOTIFY_CONN_FLAG_HAS_FSID )) {
637- conn -> fsid = * fsid ;
638- /* Pairs with smp_rmb() in fanotify_get_fsid() */
639- smp_wmb ();
640- conn -> flags |= FSNOTIFY_CONN_FLAG_HAS_FSID ;
641- } else if (fsid && (conn -> flags & FSNOTIFY_CONN_FLAG_HAS_FSID ) &&
642- (fsid -> val [0 ] != conn -> fsid .val [0 ] ||
643- fsid -> val [1 ] != conn -> fsid .val [1 ])) {
644- /*
645- * Backend is expected to check for non uniform fsid
646- * (e.g. btrfs), but maybe we missed something?
647- * Only allow setting conn->fsid once to non zero fsid.
648- * inotify and non-fid fanotify groups do not set nor test
649- * conn->fsid.
650- */
651- pr_warn_ratelimited ("%s: fsid mismatch on object of type %u: "
652- "%x.%x != %x.%x\n" , __func__ , conn -> type ,
653- fsid -> val [0 ], fsid -> val [1 ],
654- conn -> fsid .val [0 ], conn -> fsid .val [1 ]);
655- err = - EXDEV ;
656- goto out_err ;
657622 }
658623
659624 /* is mark the first mark? */
@@ -703,7 +668,7 @@ static int fsnotify_add_mark_list(struct fsnotify_mark *mark,
703668 */
704669int fsnotify_add_mark_locked (struct fsnotify_mark * mark ,
705670 fsnotify_connp_t * connp , unsigned int obj_type ,
706- int add_flags , __kernel_fsid_t * fsid )
671+ int add_flags )
707672{
708673 struct fsnotify_group * group = mark -> group ;
709674 int ret = 0 ;
@@ -723,7 +688,7 @@ int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
723688 fsnotify_get_mark (mark ); /* for g_list */
724689 spin_unlock (& mark -> lock );
725690
726- ret = fsnotify_add_mark_list (mark , connp , obj_type , add_flags , fsid );
691+ ret = fsnotify_add_mark_list (mark , connp , obj_type , add_flags );
727692 if (ret )
728693 goto err ;
729694
@@ -742,14 +707,13 @@ int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
742707}
743708
744709int fsnotify_add_mark (struct fsnotify_mark * mark , fsnotify_connp_t * connp ,
745- unsigned int obj_type , int add_flags ,
746- __kernel_fsid_t * fsid )
710+ unsigned int obj_type , int add_flags )
747711{
748712 int ret ;
749713 struct fsnotify_group * group = mark -> group ;
750714
751715 fsnotify_group_lock (group );
752- ret = fsnotify_add_mark_locked (mark , connp , obj_type , add_flags , fsid );
716+ ret = fsnotify_add_mark_locked (mark , connp , obj_type , add_flags );
753717 fsnotify_group_unlock (group );
754718 return ret ;
755719}
0 commit comments