@@ -113,47 +113,48 @@ static struct dentry *ovl_d_real(struct dentry *dentry,
113
113
return dentry ;
114
114
}
115
115
116
- static int ovl_dentry_revalidate (struct dentry * dentry , unsigned int flags )
116
+ static int ovl_revalidate_real (struct dentry * d , unsigned int flags , bool weak )
117
117
{
118
- struct ovl_entry * oe = dentry -> d_fsdata ;
119
- unsigned int i ;
120
118
int ret = 1 ;
121
119
122
- for (i = 0 ; i < oe -> numlower ; i ++ ) {
123
- struct dentry * d = oe -> lowerstack [i ].dentry ;
124
-
125
- if (d -> d_flags & DCACHE_OP_REVALIDATE ) {
126
- ret = d -> d_op -> d_revalidate (d , flags );
127
- if (ret < 0 )
128
- return ret ;
129
- if (!ret ) {
130
- if (!(flags & LOOKUP_RCU ))
131
- d_invalidate (d );
132
- return - ESTALE ;
133
- }
120
+ if (weak ) {
121
+ if (d -> d_flags & DCACHE_OP_WEAK_REVALIDATE )
122
+ ret = d -> d_op -> d_weak_revalidate (d , flags );
123
+ } else if (d -> d_flags & DCACHE_OP_REVALIDATE ) {
124
+ ret = d -> d_op -> d_revalidate (d , flags );
125
+ if (!ret ) {
126
+ if (!(flags & LOOKUP_RCU ))
127
+ d_invalidate (d );
128
+ ret = - ESTALE ;
134
129
}
135
130
}
136
- return 1 ;
131
+ return ret ;
137
132
}
138
133
139
- static int ovl_dentry_weak_revalidate (struct dentry * dentry , unsigned int flags )
134
+ static int ovl_dentry_revalidate_common (struct dentry * dentry ,
135
+ unsigned int flags , bool weak )
140
136
{
141
137
struct ovl_entry * oe = dentry -> d_fsdata ;
142
138
unsigned int i ;
143
139
int ret = 1 ;
144
140
145
- for (i = 0 ; i < oe -> numlower ; i ++ ) {
146
- struct dentry * d = oe -> lowerstack [i ].dentry ;
147
-
148
- if (d -> d_flags & DCACHE_OP_WEAK_REVALIDATE ) {
149
- ret = d -> d_op -> d_weak_revalidate (d , flags );
150
- if (ret <= 0 )
151
- break ;
152
- }
141
+ for (i = 0 ; ret > 0 && i < oe -> numlower ; i ++ ) {
142
+ ret = ovl_revalidate_real (oe -> lowerstack [i ].dentry , flags ,
143
+ weak );
153
144
}
154
145
return ret ;
155
146
}
156
147
148
+ static int ovl_dentry_revalidate (struct dentry * dentry , unsigned int flags )
149
+ {
150
+ return ovl_dentry_revalidate_common (dentry , flags , false);
151
+ }
152
+
153
+ static int ovl_dentry_weak_revalidate (struct dentry * dentry , unsigned int flags )
154
+ {
155
+ return ovl_dentry_revalidate_common (dentry , flags , true);
156
+ }
157
+
157
158
static const struct dentry_operations ovl_dentry_operations = {
158
159
.d_release = ovl_dentry_release ,
159
160
.d_real = ovl_d_real ,
0 commit comments