Lines Matching defs:dip
271 * @dip: The directory
274 struct inode *gfs2_lookup_meta(struct inode *dip, const char *name)
280 inode = gfs2_lookupi(dip, &qstr, 1);
312 struct gfs2_inode *dip = GFS2_I(dir);
328 if (gfs2_glock_is_locked_by_me(dip->i_gl) == NULL) {
329 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh);
353 * @dip: Directory in which dinode is to be created
360 static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
365 error = gfs2_permission(&nop_mnt_idmap, &dip->i_inode,
371 if (!dip->i_inode.i_nlink)
374 if (dip->i_entries == (u32)-1)
376 if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1)
382 static void munge_mode_uid_gid(const struct gfs2_inode *dip,
385 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir &&
386 (dip->i_inode.i_mode & S_ISUID) &&
387 !uid_eq(dip->i_inode.i_uid, GLOBAL_ROOT_UID)) {
390 else if (!uid_eq(dip->i_inode.i_uid, current_fsuid()))
392 inode->i_uid = dip->i_inode.i_uid;
396 if (dip->i_inode.i_mode & S_ISGID) {
399 inode->i_gid = dip->i_inode.i_gid;
554 * @dip: The directory this inode is being created in
560 static void init_dinode(struct gfs2_inode *dip, struct gfs2_inode *ip,
582 gfs2_init_dir(dibh, dip);
595 * @dip: The directory we are linking into
607 static unsigned gfs2_trans_da_blks(const struct gfs2_inode *dip,
611 return da->nr_blocks + gfs2_rg_blocks(dip, da->nr_blocks) +
615 static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
618 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
623 error = gfs2_quota_lock_check(dip, &ap);
627 error = gfs2_inplace_reserve(dip, &ap);
631 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, da, 2), 0);
640 error = gfs2_dir_add(&dip->i_inode, name, ip, da);
644 gfs2_inplace_release(dip);
646 gfs2_quota_unlock(dip);
695 struct gfs2_inode *dip = GFS2_I(dir), *ip;
696 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
707 error = gfs2_qa_get(dip);
715 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &d_gh);
720 error = create_ok(dip, name, mode);
770 munge_mode_uid_gid(dip, inode);
771 check_and_update_goal(dip);
772 ip->i_goal = dip->i_goal;
782 if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) ||
788 ip->i_diskflags |= (dip->i_diskflags & GFS2_DIF_INHERIT_JDATA);
795 if (dip->i_diskflags & GFS2_DIF_SYSTEM)
800 if ((GFS2_I(d_inode(sdp->sd_root_dir)) == dip) ||
801 (dip->i_diskflags & GFS2_DIF_TOPDIR))
848 init_dinode(dip, ip, symname);
870 error = security_inode_init_security(&ip->i_inode, &dip->i_inode, name,
875 error = link_dinode(dip, name, ip, &da);
891 gfs2_qa_put(dip);
935 gfs2_qa_put(dip);
1027 struct gfs2_inode *dip = GFS2_I(dir);
1039 error = gfs2_qa_get(dip);
1043 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &d_gh);
1074 if (!dip->i_inode.i_nlink)
1077 if (dip->i_entries == (u32)-1)
1092 error = gfs2_quota_lock_check(dip, &ap);
1096 error = gfs2_inplace_reserve(dip, &ap);
1100 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, &da, 2), 0);
1130 gfs2_inplace_release(dip);
1133 gfs2_quota_unlock(dip);
1140 gfs2_qa_put(dip);
1148 * @dip: the directory
1152 * Assumes that the lock on (at least) @dip is held.
1157 static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
1165 if ((dip->i_inode.i_mode & S_ISVTX) &&
1166 !uid_eq(dip->i_inode.i_uid, current_fsuid()) &&
1170 if (IS_APPEND(&dip->i_inode))
1173 error = gfs2_permission(&nop_mnt_idmap, &dip->i_inode,
1178 return gfs2_dir_check(&dip->i_inode, name, ip);
1183 * @dip: The parent directory
1192 static int gfs2_unlink_inode(struct gfs2_inode *dip,
1199 error = gfs2_dir_del(dip, dentry);
1229 struct gfs2_inode *dip = GFS2_I(dir);
1243 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &d_gh);
1275 error = gfs2_unlink_ok(dip, &dentry->d_name, ip);
1283 error = gfs2_unlink_inode(dip, dentry);